You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/snow-leopard/lib/ai/prompts.ts
+29-14Lines changed: 29 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,32 @@
1
1
import{ArtifactKind}from'@/components/artifact';
2
2
3
-
// Document awareness instructions
4
3
constdocumentAwarenessPrompt=`
5
-
You have access to the CURRENT DOCUMENT. Use its content silently to guide your responses - answer with a few sentences - don't over write or include the edited document content in your response.
6
-
7
-
- Only invoke internal document operations when the user's request involves document creation or content modifications.
8
-
- When a query requires up-to-date or external information not contained in the CURRENT DOCUMENT, call webSearch with an appropriate query to fetch relevant sources.
9
-
- Use webSearch for: current events, recent statistics, product comparisons, news, or any factual claims that need verification.
10
-
- For all other queries, respond normally without using any tools.
11
-
- When no active document exists, call createDocument first (with title and kind), then streamingDocument to generate and stream initial content.
12
-
- When an active document exists but is empty, call streamingDocument (with title and kind) to fill it with initial content.
13
-
- When an active document exists and has content, call updateDocument with a concise description of the desired edits (NEVER CALL TWICE or MORE THAN ONCE).
14
-
- Never reveal tool names, document IDs, or internal details; keep all updates seamless and invisible to the user.`;
15
-
16
-
// Dynamically generate the artifact-management tools section
4
+
CURRENT DOCUMENT: Read silently, never quote large chunks in your response - ONLY A THREE SENTENCE SUMMARY OF CHANGES MAX - insightful not lengthy.
5
+
6
+
• Use tools (createDocument, streamingDocument, updateDocument) for *any* doc change. Do **not** echo the change as chat text.
7
+
• One \`webSearch\` if info is outside the doc; prefer 2025-latest sources.
8
+
9
+
Lifecycle
10
+
• No doc → createDocument ⇒ streamingDocument
11
+
• Empty doc → streamingDocument
12
+
• Has content → updateDocument (call once)
13
+
14
+
EXAMPLES
15
+
1. User: "Start a travel blog outline" ⇒ createDocument(title:"Travel Blog", kind:"text") then streamingDocument.
16
+
2. User: "Add catchy intro" ⇒ updateDocument(desc:"Add a punchy intro paragraph about sustainable travel.")
// Generate full replacement content. Encourage the model to perform the *smallest* possible change set so that our diff visualisation remains concise.
51
48
constprompt=`You are an expert editor. Here is the ORIGINAL document:\n\n${originalContent}\n\n---\n\nTASK: Apply the following edits.\n- Make only the minimal changes required to satisfy the description.\n- Keep paragraphs, sentences, and words that do **not** need to change exactly as they are.\n- Do **not** paraphrase or re-flow content unless strictly necessary.\n- Preserve existing formatting and line breaks.\n\nReturn ONLY the updated document with no additional commentary.\n\nDESCRIPTION: "${description}"`;
0 commit comments