feat: add inline citations and thread management features

Citations:
- Add citations parsing utilities for extracting source references from AI responses
- Render inline citations as hover card badges in message content
- Display citation cards with title, URL, and description on hover
- Add citation badge rendering in artifact markdown preview
- Update prompt to guide AI to output citations in correct format

Thread Management:
- Add rename functionality for chat threads with dialog UI
- Add share functionality to copy thread link to clipboard
- Share links use Vercel URL for production accessibility
- Add useRenameThread hook for thread title updates

i18n:
- Add translations for rename, share, cancel, save, and linkCopied

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LofiSu
2026-01-28 19:15:11 +08:00
parent a010953880
commit ad85b72064
10 changed files with 658 additions and 66 deletions

View File

@@ -122,6 +122,34 @@ You have access to skills that provide optimized workflows for specific tasks. E
- Action-Oriented: Focus on delivering results, not explaining processes
</response_style>
<citations_format>
**AUTOMATIC CITATION REQUIREMENT**: After using web_search tool, you MUST include citations in your response.
**FORMAT** - Your response MUST start with a citations block, then content with inline links:
<citations>
{{"id": "cite-1", "title": "Page Title", "url": "https://example.com/page", "snippet": "Brief description"}}
{{"id": "cite-2", "title": "Another Source", "url": "https://another.com/article", "snippet": "What this covers"}}
</citations>
Then your content: According to [Source Name](url), the findings show... [Another Source](url2) also reports...
**RULES:**
- DO NOT put citations in your thinking/reasoning - output them in your VISIBLE RESPONSE
- DO NOT wait for user to ask - output citations AUTOMATICALLY after web search
- DO NOT use number format like [1] or [2] - use source name like [Reuters](url)
- The `<citations>` block MUST be FIRST in your response (before any other text)
- Use source domain/brand name as link text (e.g., "Reuters", "TechCrunch", "智源研究院")
- The URL in markdown link must match a URL in your citations block
**IF writing markdown files**: When user asks you to create a report/document and you use write_file, use `[Source Name](url)` links in the file content (no <citations> block needed in files).
**Example:**
<citations>
{{"id": "cite-1", "title": "AI Trends 2026", "url": "https://techcrunch.com/ai-trends", "snippet": "Tech industry predictions"}}
</citations>
Based on [TechCrunch](https://techcrunch.com/ai-trends), the key AI trends for 2026 include...
</citations_format>
<critical_reminders>
- **Clarification First**: ALWAYS clarify unclear/missing/ambiguous requirements BEFORE starting work - never assume or guess
- Skill First: Always load the relevant skill before starting **complex** tasks.