ruitanglin
a4268cb6d3
feat(frontend): unify citation logic and prevent half-finished citations
...
- Add SafeCitationContent as single component for citation-aware body:
useParsedCitations + shouldShowCitationLoading; show loading until
citations complete, then render body with createCitationMarkdownComponents.
Supports optional remarkPlugins, rehypePlugins, isHuman, img.
- Refactor MessageListItem: assistant message body now uses
SafeCitationContent only; remove duplicate useParsedCitations,
shouldShowCitationLoading, createCitationMarkdownComponents and
CitationsLoadingIndicator logic. Human messages keep plain
AIElementMessageResponse (no citation parsing).
- Use SafeCitationContent for clarification, present-files (message-list),
thinking steps and write_file loading (message-group), subtask result
(subtask-card). Artifact markdown preview keeps same guard
(shouldShowCitationLoading) with ArtifactFilePreview.
- Unify loading condition: shouldShowCitationLoading(rawContent,
cleanContent, isLoading) is the single source of truth. Show loading when
(isLoading && hasCitationsBlock(rawContent)) or when
(hasCitationsBlock(rawContent) && hasUnreplacedCitationRefs(cleanContent))
so Pro/Ultra modes also show "loading citations" and half-finished
[cite-N] never appear.
- message-group write_file: replace hasCitationsBlock + threadIsLoading
with shouldShowCitationLoading(fileContent, cleanContent,
threadIsLoading && isLast) for consistency.
- citations/utils: parse incomplete <citations> during streaming;
remove isCitationsBlockIncomplete; keep hasUnreplacedCitationRefs
internal; document display rule in file header.
Co-authored-by: Cursor <cursoragent@cursor.com >
---
feat(前端): 统一引用逻辑并杜绝半成品引用
- 新增 SafeCitationContent 作为引用正文的唯一出口:内部使用
useParsedCitations + shouldShowCitationLoading,在引用未就绪时只显示
「正在整理引用」,就绪后用 createCitationMarkdownComponents 渲染正文;
支持可选 remarkPlugins、rehypePlugins、isHuman、img。
- 重构 MessageListItem:助手消息正文仅通过 SafeCitationContent 渲染,
删除重复的 useParsedCitations、shouldShowCitationLoading、
createCitationMarkdownComponents、CitationsLoadingIndicator 等逻辑;
用户消息仍用 AIElementMessageResponse,不做引用解析。
- 澄清、present-files(message-list)、思考步骤与 write_file 加载
(message-group)、子任务结果(subtask-card)均使用
SafeCitationContent;Artifact 的 markdown 预览仍用同一 guard
shouldShowCitationLoading,正文由 ArtifactFilePreview 渲染。
- 统一加载条件:shouldShowCitationLoading(rawContent, cleanContent,
isLoading) 为唯一判断。在「流式中且已有引用块」或「有引用块且
cleanContent 中仍有未替换的 [cite-N]」时仅显示加载,从而在 Pro/Ultra
下也能看到「正在整理引用」,且永不出现半成品 [cite-N]。
- message-group 的 write_file:用 shouldShowCitationLoading(
fileContent, cleanContent, threadIsLoading && isLast) 替代
hasCitationsBlock + threadIsLoading,与其他场景一致。
- citations/utils:流式时解析未闭合的 <citations>;移除
isCitationsBlockIncomplete;hasUnreplacedCitationRefs 保持内部使用;
在文件头注释中说明展示规则。
2026-02-09 15:01:51 +08:00
ruitanglin
2b10b97bb9
chore(frontend): remove unused Citation UI components from inline-citation
...
- Remove InlineCitation, InlineCitationText, InlineCitationCardTrigger
- Remove InlineCitationCarousel and all Carousel subcomponents (Content, Item, Header, Index, Prev, Next)
- Remove InlineCitationQuote
- Drop Carousel/carousel and ArrowLeft/ArrowRight icon imports; keep only CitationLink, CitationAwareLink, CitationsLoadingIndicator and their dependencies
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-02-09 12:49:31 +08:00
ruitanglin
175c1d2e3b
refactor(frontend): simplify and deduplicate Citation-related code
...
- Extract removeCitationsBlocks in utils, reuse in parseCitations and removeAllCitations
- Add hasCitationsBlock; isCitationsBlockIncomplete now uses it
- Add useParsedCitations hook (parseCitations + buildCitationMap) for message/artifact
- Add CitationAwareLink to unify link rendering (message-list-item + artifact-file-detail)
- Add getCleanContent helper; message-group uses it and useParsedCitations
- ArtifactFileDetail: single useParsedCitations, pass cleanContent/citationMap to Preview
- Stop exporting buildCitationMap and removeCitationsBlocks from citations index
- Remove duplicate MessageLink and inline link logic in artifact preview
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-02-09 12:13:06 +08:00
ruitanglin
f577ff115b
Revert "fix(frontend): Turbopack about page + remove hover on web search/citations"
...
This reverts commit 7e9e061f20fcec1f1a9c35be40d9407c05ed82be.
2026-02-09 03:23:51 +08:00
ruitanglin
77859d01b8
fix(frontend): Turbopack about page + remove hover on web search/citations
...
- About: use aboutMarkdown from about-content.ts instead of raw-loader for
about.md (fixes Turbopack 'Cannot find module raw-loader')
- Web search: remove Tooltip from web_search and web_fetch result links
- Citations: remove HoverCard from CitationLink so no hover popup on badges
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-02-09 03:23:02 +08:00
Henry Li
17b2630b73
fix: adjust suggestion positioning and height for improved UI layout
2026-02-07 17:56:06 +08:00
LofiSu
9f8d9e4da2
Merge pull request #25 from LofiSu/feat/citations
...
feat(citations): add shared citation components and optimize code
2026-02-07 12:13:32 +08:00
Henry Li
fc543a9b30
feat: add animations
2026-02-07 10:30:35 +08:00
ruitanglin
c87f176fac
fix(citations): use markdown link text as fallback for display
...
When citation data is not available, use the markdown link text
(children) as display text instead of just the domain. This ensures
that links like [OpenJudge](github.com/...) show 'OpenJudge' instead
of just 'github.com'.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-02-06 15:06:51 +08:00
ruitanglin
0f9e3d508b
fix(citations): improve citation link rendering and copy behavior
...
- Use citation.title for display text in CitationLink to ensure correct
titles show during streaming (instead of generic "Source" text)
- Render all external links as CitationLink badges for consistent styling
during streaming output
- Add removeAllCitations when copying message content to clipboard
- Simplify citations_format prompt for cleaner AI output
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-02-04 16:34:12 +08:00
ruitanglin
1e2675beb3
feat(citations): add shared citation components and optimize code
...
## New Features
- Add `CitationLink` shared component for rendering citation hover cards
- Add `CitationsLoadingIndicator` component for showing loading state
- Add `removeAllCitations` utility to strip all citations from content
- Add backend support for removing citations when downloading markdown files
- Add i18n support for citation loading messages (en-US, zh-CN)
## Code Optimizations
- Remove duplicate `ExternalLinkBadge` component, reuse `CitationLink` instead
- Consolidate `remarkPlugins` config in `streamdownPlugins` to avoid duplication
- Remove unused imports: `Citation`, `buildCitationMap`, `extractDomainFromUrl`, etc.
- Remove unused `messages` parameter from `ToolCall` component
- Remove unused `isWriteFile` parameter from `ArtifactFilePreview` component
- Remove unused `useI18n` hook from `MessageContent` component
## Bug Fixes
- Fix `remarkGfm` plugin configuration that prevented table rendering
- Fix React Hooks rule violation: move `useMemo` to component top level
- Replace `||` with `??` for nullish coalescing in clipboard data
## Code Cleanup
- Remove debug console.log/info statements from:
- `threads/hooks.ts`
- `notification/hooks.ts`
- `memory-settings-page.tsx`
- Fix import order in `message-group.tsx`
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-02-04 11:56:10 +08:00
Henry Li
e673405c00
feat: add suggestions
2026-02-02 11:21:30 +08:00
Henry Li
f1db301d77
feat: add file icons
2026-02-02 10:02:31 +08:00
Henry Li
66deedf3b2
fix: add max width
2026-01-29 16:12:30 +08:00
Henry Li
28361ca03c
feat: add scroll indicator
2026-01-27 13:15:49 +08:00
Henry Li
cd63f41b4c
feat: support static website
2026-01-24 18:01:27 +08:00
Henry Li
7d4d706738
feat: put all options into '+'
2026-01-22 13:43:45 +08:00
Henry Li
1e4e51a80c
feat: add Todos
2026-01-22 00:26:11 +08:00
Henry Li
11c562eb98
refactor: move
2026-01-21 10:46:43 +08:00
Henry Li
48742d1b59
feat: add code editor
2026-01-21 09:33:33 +08:00
Henry Li
7c6eb4cc8b
feat: enlarge shadow
2026-01-21 08:52:30 +08:00
Henry Li
b8f9678d07
feat: use code block to display bash commands
2026-01-19 21:59:23 +08:00
Henry Li
69b225082b
feat: re-implement message group
2026-01-18 19:56:07 +08:00
Henry Li
dd80348b76
feat: support SSE write_file(0
2026-01-18 17:13:15 +08:00
Henry Li
92fc19a3aa
feat: remove model icon
2026-01-18 09:55:17 +08:00
Henry Li
f1c6991194
feat: integrated with artifacts in states
2026-01-17 17:21:37 +08:00
Henry Li
9d1cf89532
chore: remove unused components
2026-01-17 10:09:43 +08:00
Henry Li
61499624a0
feat: adjust message group layout
2026-01-15 23:56:42 +08:00
Henry Li
c3cb4c348d
feat: remove max-w-
2026-01-15 23:47:28 +08:00
Henry Li
9f2b94ed52
feat: implement basic web app
2026-01-15 23:40:21 +08:00
Henry Li
c628c7f8db
chore: create frontend project from boilerplate
2026-01-14 09:50:26 +08:00