Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TOC generation should now be consistent #66

Merged
merged 9 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .scripts/idxtool.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def rebuild_toc(toc_out: str = '') -> Tuple[bool, str]:
else:
out.append(line)
if not marker_found:
return (False, f"Could not find the marker '{TOC_GPT_MARKER_LINE}' in '{toc_in}'.")
return (False, f"Could not find the marker '{TOC_GPT_MARKER_LINE}' in '{toc_in}'. Please revert the TOC file and try again.")

# Write the TOC file all the way up to the marker line
try:
Expand All @@ -107,16 +107,21 @@ def rebuild_toc(toc_out: str = '') -> Tuple[bool, str]:
for ok, gpt in enum_gpts():
nb_total += 1
if ok:
if id := gpt.id():
if gpt_id := gpt.id():
nb_ok += 1
gpts.append((id, gpt))
gpts.append((gpt_id, gpt))
else:
print(f"[!] No ID detected: {gpt.filename}")
else:
print(f"[!] {gpt}")

# Consistently sort the GPTs by ID
gpts.sort(key=lambda x: x[0].id)
# Consistently sort the GPTs by ID and GPTs title
def gpts_sorter(key):
gpt_id, gpt = key
version = f"{gpt.get('version')}" if gpt.get('version') else ''
return f"{gpt.get('title')}{version} (id: {gpt_id.id}))"
gpts.sort(key=gpts_sorter)

for id, gpt in gpts:
file_link = f"./prompts/gpts/{quote(os.path.basename(gpt.filename))}"
version = f" {gpt.get('version')}" if gpt.get('version') else ''
Expand Down
8 changes: 0 additions & 8 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "idxtool-Update Logo",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/.scripts/idxtool.py",
"args": ["--update-logo", "logo.png"],
"console": "integratedTerminal"
},
{
"name": "idxtool-Rebuild TOC",
"type": "python",
Expand Down
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# ChatGPT_system_prompt
valuable agent's system prompt,find GPT's prompt in [TOC.md](./TOC.md)

This repository is a collection of various system prompts for ChatGPT and [custom GPTs](https://openai.com/blog/introducing-gpts), providing significant educational value in learning about writing system prompts and creating custom GPTs.

For a quick start, go to [TOC.md](./TOC.md) to find the specific GPT or system prompt you need.

Other topics:

- [How to get system prompt?](#how-to-get-system-prompt)
- [How to get knowledge files?](#how-to-get-knowledge-files)
- [How to protect GPT instructions?](#how-to-protect-gpt-instructions)
- [How to get GPT's action schema?](#how-to-get-gpts-action-schema)
- [Contribution](#contribution)
- [Learning resources](#learning-resources)
- [Find system prompts and custom GPTs](./TOC.md)


<img src="bg.png" width="600px" />

Expand Down Expand Up @@ -96,9 +110,9 @@ some useful GPTs may be helpful:
2. [GPT Shop Keeper](https://chat.openai.com/g/g-22ZUhrOgu-gpt-shop-keeper)


## If you want to contribute to this repo
## Contribution

Please follow the format below; it is important to keep the format consistent for the [`idxtool`](./scripts/idxtool.py).
Please follow the format below; it is important to keep the format consistent for the [`idxtool`](./.scripts/idxtool.py).

```markdown
GPT URL: You put the GPT url here
Expand Down Expand Up @@ -154,7 +168,6 @@ NOTE: Please try not to use weird file name characters and avoid using '[' and '
- https://www.reddit.com/r/ChatGPTJailbreak/
- https://github.com/0xeb/gpt-analyst/


## Disclaimer

The sharing of these prompts/instructions is purely for reference and knowledge sharing, aimed at enhancing everyone's prompt writing skills and raising awareness about prompt injection security.
Expand Down
Loading