mirror of
https://github.com/LouisShark/chatgpt_system_prompt.git
synced 2025-07-05 22:30:37 -04:00
Merge pull request #64 from lallouslab/fixidxtool
This commit is contained in:
commit
0ff994a810
1 changed files with 11 additions and 10 deletions
|
@ -65,15 +65,7 @@ class GptMarkdownFile:
|
|||
Return the GPT identifier.
|
||||
:return: GptIdentifier object.
|
||||
"""
|
||||
url = self.fields.get('url')
|
||||
if url and url.startswith(GPT_BASE_URL):
|
||||
id = url[GPT_BASE_URL_L:].split('\n')[0]
|
||||
i = id.find('-')
|
||||
if i != -1:
|
||||
return GptIdentifier(id[:i], id[i+1:].strip())
|
||||
else:
|
||||
return GptIdentifier(id, '')
|
||||
return None
|
||||
return parse_gpturl(self.fields.get('url'))
|
||||
|
||||
def __str__(self) -> str:
|
||||
sorted_fields = sorted(self.fields.items(), key=lambda x: SUPPORTED_FIELDS[x[0]].order)
|
||||
|
@ -129,6 +121,15 @@ class GptMarkdownFile:
|
|||
except Exception as e:
|
||||
return (False, f"Failed to save file '{file_path}': {e}")
|
||||
|
||||
def parse_gpturl(url: str) -> Union[GptIdentifier, None]:
|
||||
if url and url.startswith(GPT_BASE_URL):
|
||||
id = url[GPT_BASE_URL_L:].split('\n')[0]
|
||||
i = id.find('-')
|
||||
if i != -1:
|
||||
return GptIdentifier(id[:i], id[i+1:])
|
||||
else:
|
||||
return GptIdentifier(id, '')
|
||||
|
||||
|
||||
def get_prompts_path() -> str:
|
||||
"""Return the path to the prompts directory."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue