🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(prompts): use XML format for topic title generation to improve DeepSeek compatibility (#15413)
Hardy7f3f1278e4e8
diff --git a/packages/prompts/src/chains/__tests__/__snapshots__/summaryTitle.test.ts.snap b/packages/prompts/src/chains/__tests__/__snapshots__/summaryTitle.test.ts.snapindex 8648a40e378..4cee4144348 100644--- a/packages/prompts/src/chains/__tests__/__snapshots__/summaryTitle.test.ts.snap+++ b/packages/prompts/src/chains/__tests__/__snapshots__/summaryTitle.test.ts.snap@@ -17,8 +17,18 @@ Rules:"role": "system",},{- "content": "assistant: Hello, how can I assist you?-user: I need help with my account.",+ "content": "<task>+Generate a concise title that captures the essence of the conversation.+</task>++<conversation>+<assistant>+Hello, how can I assist you?+</assistant>+<user>+I need help with my account.+</user>+</conversation>","role": "user",},],diff --git a/packages/prompts/src/chains/summaryTitle.ts b/packages/prompts/src/chains/summaryTitle.tsindex ea612283424..b8d5034d1ce 100644--- a/packages/prompts/src/chains/summaryTitle.ts+++ b/packages/prompts/src/chains/summaryTitle.ts@@ -3,10 +3,15 @@ import type { ChatStreamPayload, OpenAIChatMessage, UIChatMessage } from '@lobecexport const chainSummaryTitle = (messages: (UIChatMessage | OpenAIChatMessage)[],locale: string,-): Partial<ChatStreamPayload> => ({- messages: [- {- content: `You are a professional conversation summarizer. Generate a concise title that captures the essence of the conversation.+): Partial<ChatStreamPayload> => {+ const conversationText = messages+ .map((message) => `<${message.role}>\n${String(message.content ?? '')}\n</${message.role}>`)+ .join('\n');++ return {+ messages: [+ {+ content: `You are a professional conversation summarizer. Generate a concise title that captures the essence of the conversation.Rules:- Output ONLY the title text, no explanations or additional context@@ -16,11 +21,12 @@ Rules:- Use the language specified by the locale code: ${locale}- The title should accurately reflect the main topic of the conversation- Keep it short and to the point`,- role: 'system',- },- {- content: messages.map((message) => `${message.role}: ${message.content}`).join('\n'),- role: 'user',- },- ],-});+ role: 'system',+ },+ {+ content: `<task>\nGenerate a concise title that captures the essence of the conversation.\n</task>\n\n<conversation>\n${conversationText}\n</conversation>`,+ role: 'user',+ },+ ],+ };+};