Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🖇️ refactor: Improve prompt for Better Citation Formatting (#10858)
Michael Ludviga07cc11cd602
diff --git a/api/app/clients/tools/util/handleTools.js b/api/app/clients/tools/util/handleTools.jsindex 5692bee8db..032255b64c 100644--- a/api/app/clients/tools/util/handleTools.js+++ b/api/app/clients/tools/util/handleTools.js@@ -317,14 +317,22 @@ const loadTools = async ({requestedTools[tool] = async () => {toolContextMap[tool] = `# \`${tool}\`:Current Date & Time: ${replaceSpecialVars({ text: '{{iso_datetime}}' })}-1. **Execute immediately without preface** when using \`${tool}\`.-2. **After the search, begin with a brief summary** that directly addresses the query without headers or explaining your process.-3. **Structure your response clearly** using Markdown formatting (Level 2 headers for sections, lists for multiple points, tables for comparisons).-4. **Cite sources properly** according to the citation anchor format, utilizing group anchors when appropriate.-5. **Tailor your approach to the query type** (academic, news, coding, etc.) while maintaining an expert, journalistic, unbiased tone.-6. **Provide comprehensive information** with specific details, examples, and as much relevant context as possible from search results.-7. **Avoid moralizing language.**-`.trim();++**Execute immediately without preface.** After search, provide a brief summary addressing the query directly, then structure your response with clear Markdown formatting (## headers, lists, tables). Cite sources properly, tailor tone to query type, and provide comprehensive details.++**CITATION FORMAT - INVISIBLE UNICODE ANCHORS ONLY:**+Use these Unicode characters: \\ue202 (before each anchor), \\ue200 (group start), \\ue201 (group end), \\ue203 (highlight start), \\ue204 (highlight end)++Anchor pattern: turn{N}{type}{index} where N=turn number, type=search|news|image|ref, index=0,1,2...++**Examples:**+- Single: "Statement.\\ue202turn0search0"+- Multiple: "Statement.\\ue202turn0search0\\ue202turn0news1"+- Group: "Statement. \\ue200\\ue202turn0search0\\ue202turn0news1\\ue201"+- Highlight: "\\ue203Cited text.\\ue204\\ue202turn0search0"+- Image: "See photo\\ue202turn0image0."++**CRITICAL:** Place anchors AFTER punctuation. Cite every non-obvious fact/quote. NEVER use markdown links, [1], footnotes, or HTML tags.`.trim();return createSearchTool({...result.authResult,onSearchResults,