Browse Source

fix: session title generation (#293)

Márk Magyar 8 months ago
parent
commit
137e964131

+ 1 - 1
packages/opencode/src/provider/transform.ts

@@ -1,4 +1,4 @@
-import type { CoreMessage, LanguageModelV1Prompt } from "ai"
+import type { LanguageModelV1Prompt } from "ai"
 import { unique } from "remeda"
 
 export namespace ProviderTransform {

+ 11 - 7
packages/opencode/src/session/prompt/title.txt

@@ -1,7 +1,11 @@
-You will generate a short title based on the first message a user begins a conversation with
-- ensure it is not more than 50 characters long
-- the title should be a summary of the user's message
-- it should be one line long
-- do not use quotes or colons
-- the entire text you return will be used as the title
-- never return anything that is more than one sentence (one line) long
+Generate a short title based on the first message a user begins a conversation with. CRITICAL: Your response must be EXACTLY one line with NO line breaks, newlines, or multiple sentences.
+
+Requirements:
+- Maximum 50 characters
+- Single line only - NO newlines or line breaks
+- Summary of the user's message
+- No quotes, colons, or special formatting
+- Do not include explanatory text like "summary:" or similar
+- Your entire response becomes the title
+
+IMPORTANT: Return only the title text on a single line. Do not add any explanations, formatting, or additional text.