Skip to content

Fix citation link mapping for duplicate URLs and unstable cite_index#276

Merged
CJackHwang merged 4 commits intomainfrom
dev
Apr 21, 2026
Merged

Fix citation link mapping for duplicate URLs and unstable cite_index#276
CJackHwang merged 4 commits intomainfrom
dev

Conversation

@CJackHwang
Copy link
Copy Markdown
Owner

💻 变更类型 | Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 👷 build
  • ⚡️ perf
  • 📝 docs
  • 🔨 chore

🔀 变更说明 | Description of Change

Fix citation link mapping for duplicate URLs and unstable cite_index

📝 补充信息 | Additional Information

livesRan and others added 3 commits April 21, 2026 10:52
…复来源且 cite_index 缺失或不稳定时,位置索引被压缩,部分 [citation:x] 无法找到对应链接。修复后改为保留上游结果的原始顺序(包括重复 URL),从而保证按位置回填 citation 时不会丢号。
修复重复 URL 且 cite_index 不稳定时 citation 映射不完整的问题
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ds2api Ready Ready Preview, Comment Apr 21, 2026 3:54am

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a2fc42dad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 129 to 130
func (c *citationLinkCollector) addOrdered(url string) {
if _, ok := c.seen[url]; ok {
return
}
c.seen[url] = struct{}{}
c.ordered = append(c.ordered, url)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reinstate de-dup for refreshed results lists

addOrdered now appends every URL occurrence, so when the stream sends multiple response/fragments/*/results updates for the same fragment (especially o:"SET" refreshes with overlapping URLs), the ordered slice accumulates duplicates and shifts fallback index mapping in build(). In that case later markers (e.g. [citation:3]) can resolve to an earlier repeated URL instead of the newly added source, producing wrong citation links in responses that rely on nil/unstable cite_index values.

Useful? React with 👍 / 👎.

更新为AGPL3.0
@CJackHwang CJackHwang merged commit e9a544c into main Apr 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants