mirror of
https://github.com/aurelienstebe/Gladdis.git
synced 2026-07-22 08:40:27 +00:00
fix: switch to underscores for sections to avoid conflicts
This commit is contained in:
parent
f3bc878591
commit
d25b0d0901
12 changed files with 33 additions and 53 deletions
|
|
@ -61,9 +61,9 @@ The same familiar Obsidian syntax from your notes is used for the conversation h
|
|||
```md
|
||||
Just use standard Markdown text for `User` messages and prompts.
|
||||
The content of the Gladdis config file will be prepended to this.
|
||||
Use triple dashes to separate messages / sections of conversation.
|
||||
Use triple underscores to separate the sections of conversation.
|
||||
|
||||
---
|
||||
___
|
||||
|
||||
__UserName:__ labels also start a new message with custom names.
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ __Gladdis:__ Gladdis' label and `Assistant` are for AI messages.
|
|||
|
||||
__System:__ is for System Prompts (the default in config files).
|
||||
|
||||
---
|
||||
___
|
||||
|
||||
> Quoted lines are ignored, error and token counter callouts too.
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ export async function processContent(context: Context): Promise<void> {
|
|||
|
||||
export async function processPrompt(context: Context): Promise<void> {
|
||||
context = await loadContext(prepareContext(context))
|
||||
context.file.text = context.file.text.split('\n---').at(-1) ?? ''
|
||||
context.file.text = context.file.text.split('\n___\n').at(-1) ?? ''
|
||||
context = loadContent(context)
|
||||
|
||||
context.whisper.echoOutput = true
|
||||
|
|
|
|||
|
|
@ -61,9 +61,9 @@ export async function doGladdis(context: Context): Promise<void> {
|
|||
void logGladdisChat(context)
|
||||
|
||||
let tokenModal = getTokenModal(context)
|
||||
if (tokenModal.contains('__@__@__@__')) tokenModal = ''
|
||||
if (tokenModal.includes('__@__@__@__')) tokenModal = ''
|
||||
|
||||
const message = `${tokenModal}\n\n---\n\n__${context.user.label}:__ `
|
||||
const message = `${tokenModal}\n\n___\n\n__${context.user.label}:__ `
|
||||
await context.file.disk.appendFile(context.file.path, message)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,8 +96,8 @@ export default class GladdisPlugin extends Plugin {
|
|||
await this.loadSecrets()
|
||||
|
||||
addIcon('gladdisLogo', `<path ${logoPathAttr} d="${logoMainPath}"/>`)
|
||||
addIcon('gladdisHalf', `<path ${logoPathAttr} d="${logoMainPath}${logoLeftPath}"/>`)
|
||||
addIcon('gladdisFull', `<path ${logoPathAttr} d="${logoMainPath}${logoLeftPath}${logoFullPath}"/>`)
|
||||
addIcon('gladdisHalf', `<path ${logoPathAttr} d="${logoLeftPath}"/>`)
|
||||
addIcon('gladdisFull', `<path ${logoPathAttr} d="${logoFullPath}"/>`)
|
||||
|
||||
this.addCommand({
|
||||
icon: 'gladdisLogo',
|
||||
|
|
@ -157,7 +157,7 @@ export default class GladdisPlugin extends Plugin {
|
|||
await this.processWithContext(editor, view, async (context: Context) => {
|
||||
context = await loadContext(context)
|
||||
if (editor.somethingSelected()) context.file.text = editor.getSelection()
|
||||
else context.file.text = context.file.text.split('\n---').at(-1) ?? ''
|
||||
else context.file.text = context.file.text.split('\n___\n').at(-1) ?? ''
|
||||
context = loadContent(context)
|
||||
|
||||
context.whisper.echoOutput = true
|
||||
|
|
@ -314,7 +314,7 @@ class VaultInterface implements DiskInterface {
|
|||
extName(path: string): string {
|
||||
const fileName = normalizePath(path).split('/').at(-1) ?? ''
|
||||
|
||||
if (!fileName.contains('.')) return ''
|
||||
if (!fileName.includes('.')) return ''
|
||||
return '.' + fileName.split('.').at(-1)
|
||||
}
|
||||
|
||||
|
|
@ -691,6 +691,7 @@ c0 0 .5 -.5 .5 -4
|
|||
c0 -.5 0 -1 0 -1.3`
|
||||
|
||||
const logoLeftPath = `
|
||||
${logoMainPath}
|
||||
m-34 6
|
||||
a8 8 0 0 1 -.5 1.75
|
||||
c-1 4 -4 7 -11.75 7
|
||||
|
|
@ -701,6 +702,7 @@ c2 0 10 0 15.3 1.2
|
|||
c1.5 .5 4 1 3.33 4`
|
||||
|
||||
const logoFullPath = `
|
||||
${logoLeftPath}
|
||||
m30 2.5
|
||||
c-.5 4.5 -1.5 6.5 -9.5 6.5
|
||||
c-8 0 -11 -3 -11.75 -7
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ const pdfContentRegex = /^\[!ABSTRACT\][+-]? Content from "([^"]+?\.pdf)"$/i
|
|||
const webContentRegex = /^\[!EXAMPLE\][+-]? Web Page from <(https?:\/\/[^"]+?)>$/i
|
||||
|
||||
export function parseHistory(context: Context): ChatMessage[] {
|
||||
const lines = (context.file.text + '\n---\n').split('\n')
|
||||
const lines = (context.file.text + '\n___\n').split('\n')
|
||||
const history: ChatMessage[] = []
|
||||
|
||||
let label = context.user.label
|
||||
|
|
@ -38,7 +38,7 @@ export function parseHistory(context: Context): ChatMessage[] {
|
|||
if (line.trim() === '"""') textBlock = true
|
||||
|
||||
prompt.push(line)
|
||||
} else if (line.trim() === '---') {
|
||||
} else if (line.trim() === '___') {
|
||||
history.push(parsePrompt(label, prompt, quotes, context))
|
||||
label = context.user.label
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ exports[`the history Content > parses complex messages 1`] = `
|
|||
},
|
||||
{
|
||||
"content": """"Text block 1
|
||||
---
|
||||
___
|
||||
> is escaped"""",
|
||||
"name": "Myself",
|
||||
"role": "user",
|
||||
|
|
|
|||
|
|
@ -10,26 +10,26 @@ import type { Context } from '../src/types/context.js'
|
|||
const complexFile = `
|
||||
> Quoted Message 1
|
||||
My User Message 1
|
||||
---
|
||||
___
|
||||
__User:__ User Message 2
|
||||
---
|
||||
___
|
||||
__Myself:__ User Message 3
|
||||
---
|
||||
___
|
||||
__MyFriend:__ User Message 4
|
||||
---
|
||||
___
|
||||
>__User:__ Quoted Message 2
|
||||
|
||||
__System:__ System Message 1
|
||||
---
|
||||
___
|
||||
__Gladdis:__ Gladdis Message 1
|
||||
---
|
||||
___
|
||||
__Assistant:__ Gladdis Message 2
|
||||
---
|
||||
___
|
||||
> """Quoted Message 3"""
|
||||
"""Text block 1
|
||||
---
|
||||
___
|
||||
> is escaped"""
|
||||
---
|
||||
___
|
||||
"""
|
||||
Text block 2 with
|
||||
multiline content
|
||||
|
|
@ -38,34 +38,34 @@ and a code block:
|
|||
echo "Code block with Bash code"
|
||||
\`\`\`
|
||||
"""
|
||||
---
|
||||
___
|
||||
>Quoted Message 4
|
||||
> with multilines
|
||||
\`\`\`
|
||||
alert("Code block with JS code")
|
||||
\`\`\`
|
||||
---
|
||||
___
|
||||
\`\`\`python
|
||||
def test():
|
||||
"""Test function."""
|
||||
print("Hello World!")
|
||||
\`\`\`
|
||||
---
|
||||
___
|
||||
__Myself:__![[recording.webm]]
|
||||
|
||||
> [!QUOTE]- Transcript from "recording.webm"
|
||||
> Here is the transcription of the recording.
|
||||
---
|
||||
___
|
||||
__System:__ [[document.pdf]]
|
||||
|
||||
> [!ABSTRACT]- Content from "document.pdf"
|
||||
> Here is the text content of the PDF file.
|
||||
---
|
||||
___
|
||||
__Myself:__ <http://mysite.com>
|
||||
|
||||
> [!EXAMPLE]- Web Page from <http://mysite.com>
|
||||
> Here is the main content of the Web Page.
|
||||
---
|
||||
___
|
||||
__User:__Prompt Text`
|
||||
|
||||
describe('the history Content', () => {
|
||||
|
|
@ -74,7 +74,7 @@ describe('the history Content', () => {
|
|||
})
|
||||
|
||||
it('parses simple messages', async () => {
|
||||
const simpleFile = 'Message 1\n---\nMessage 2\n---\nMessage 3'
|
||||
const simpleFile = 'Message 1\n___\nMessage 2\n___\nMessage 3'
|
||||
diskInterface.readFile = vi.fn().mockResolvedValue(simpleFile)
|
||||
|
||||
const callContext: any = {
|
||||
|
|
@ -117,8 +117,8 @@ describe('the history Content', () => {
|
|||
whisper: { config: 'whisper' },
|
||||
})}---\n`
|
||||
|
||||
const gladdisConf = 'System Prompt 1\n---\nSystem Prompt 2'
|
||||
const whisperConf = 'Whisper input is not parsed\n---\n> !'
|
||||
const gladdisConf = 'System Prompt 1\n___\nSystem Prompt 2'
|
||||
const whisperConf = 'Whisper input is not parsed\n___\n> !'
|
||||
|
||||
diskInterface.pathExists = vi.fn().mockResolvedValue(true)
|
||||
|
||||
|
|
|
|||
|
|
@ -11,16 +11,12 @@ In your interactions, you should maintain a casual, friendly, yet serious tone,
|
|||
|
||||
Your ultimate goal is to help the user generate ideas and explore new possibilities, while also providing some structure to the brainstorming process. Your purpose is to support the user's journey towards deeper understanding and creative breakthroughs.
|
||||
|
||||
---
|
||||
|
||||
**Guidelines**
|
||||
- Respect the user's feedback and decisions, and drop any ideas or questions that the user dismisses and/or rejects.
|
||||
- Ensure that nothing is left behind, that everything is explored, find new ideas, new paths until there are no more to find.
|
||||
- If the conversation deviates from the original topic, point it out to the user and ask for their guidance on how to proceed.
|
||||
- Always provide a brief overview of each idea, focusing on capturing the essence of the idea without unnecessary details.
|
||||
|
||||
---
|
||||
|
||||
**Instructions**
|
||||
1. Listen carefully to the user's input and rephrase it in your own words to ensure understanding.
|
||||
2. Based on the user's input, generate a list of questions, ideas, areas, and new paths to explore.
|
||||
|
|
|
|||
|
|
@ -13,14 +13,10 @@ Your ultimate goal is to help the user improve their code to the point where you
|
|||
|
||||
Your work is inspired by the principles outlined in the "Gang of Four" design patterns book, a seminal guide to software design. You strive to uphold these principles in your code review and analysis, ensuring that every code file you review is not only correct but also well-structured and well-designed.
|
||||
|
||||
---
|
||||
|
||||
**Guidelines**
|
||||
- Prioritize your corrections and improvements, listing the most critical ones at the top and the less important ones at the bottom.
|
||||
- Organize your feedback into three distinct sections: formatting, corrections, and analysis. Each section should contain a list of potential improvements relevant to that category.
|
||||
|
||||
---
|
||||
|
||||
**Instructions**
|
||||
1. Begin by reviewing the formatting of the code. Identify any issues with indentation, spacing, alignment, or overall layout, to make the code aesthetically pleasing and easy to read.
|
||||
2. Next, focus on the correctness of the code. Check for any coding errors or typos, ensure that the code is syntactically correct and functional.
|
||||
|
|
|
|||
|
|
@ -13,16 +13,12 @@ Your prompts should be well-structured and organized, providing the AI with clea
|
|||
|
||||
Your ultimate goal is to create prompts that effectively guide the AI's actions and decision-making, leading to meaningful and impactful interactions with users. In all your work, strive for clarity, accuracy, and user satisfaction, ensuring that the AI effectively meets the needs of its users.
|
||||
|
||||
---
|
||||
|
||||
**Guidelines**
|
||||
- Always consider the specific type of AI and its intended use when crafting prompts. Tailor your prompts to the AI's expertise and the user's needs.
|
||||
- Maintain clarity and conciseness in your prompts. Avoid ambiguity and ensure your instructions are easy for the AI to understand and follow.
|
||||
- Use a respectful and professional tone in your prompts. Ensure the language and tone align with the user's preferences and the context of the task.
|
||||
- Adhere to the principles and best practices outlined in the "How to Write System Prompts" document.
|
||||
|
||||
---
|
||||
|
||||
**Documents**
|
||||
- [[Gladdis/library/manuals/How to Write System Prompts|How to Write System Prompts Document]]
|
||||
- [[Gladdis/library/prompts/Personal Chatbot Guidelines|Personal Chatbot Guidelines Document]]
|
||||
|
|
@ -33,8 +29,6 @@ Your ultimate goal is to create prompts that effectively guide the AI's actions
|
|||
- [[Gladdis/configs/ProofReaddis|Proof Reading AI Config Example]]
|
||||
- [[Gladdis/configs/CodeReviewis|Code Reviewing AI Config Example]]
|
||||
|
||||
---
|
||||
|
||||
**Instructions**
|
||||
1. Begin by understanding the specific type of AI and its intended use. This will guide your prompt crafting process.
|
||||
2. Always ask follow-up questions to clarify ambiguities and gather additional information about the context of the task.
|
||||
|
|
|
|||
|
|
@ -13,14 +13,10 @@ Your ultimate goal is to help the user improve their document to the point where
|
|||
|
||||
Your work is inspired by the principles outlined in "The Elements of Style", a seminal guide to English writing. You strive to uphold these principles in your proofreading and analysis, ensuring that every document you review is not only correct but also well-written and impactful.
|
||||
|
||||
---
|
||||
|
||||
**Guidelines**
|
||||
- Prioritize your corrections and improvements, listing the most critical ones at the top and the less important ones at the bottom.
|
||||
- Organize your feedback into three distinct sections: formatting, corrections, and analysis. Each section should contain a list of potential improvements relevant to that category.
|
||||
|
||||
---
|
||||
|
||||
**Instructions**
|
||||
1. Begin by reviewing the formatting of the document. Identify any issues with indentation, spacing, alignment, or overall layout.
|
||||
2. Next, focus on the correctness of the document. Check for any grammatical, spelling, or sentence structure errors; ignore the punctuation.
|
||||
|
|
|
|||
|
|
@ -9,15 +9,11 @@ You are a transcription AI, your primary function is to transcribe ideas into we
|
|||
|
||||
Your tone and personality should remain neutral, focusing solely on the task of writing the text as requested by the user. Your ultimate goal is to help the user transcribe their ideas into a well-crafted document which could be published.
|
||||
|
||||
---
|
||||
|
||||
**Guidelines**
|
||||
- Ensure that the output text is well-written, with no spelling errors or grammar mistakes.
|
||||
- Unless specified otherwise by the user, format the output text in Markdown as default.
|
||||
- Make corrections and modifications according to the user's feedback and comments.
|
||||
|
||||
---
|
||||
|
||||
**Instructions**
|
||||
1. Read all provided resources, paying particular attention to the user's instructions.
|
||||
2. Directly output the requested section of the document as per the user's demand.
|
||||
|
|
|
|||
Loading…
Reference in a new issue