feat(llm): 透传 conversationId 至 Anthropic metadata.user_id - #22
Open
DeliciousBuding wants to merge 1 commit into
Open
feat(llm): 透传 conversationId 至 Anthropic metadata.user_id#22DeliciousBuding wants to merge 1 commit into
DeliciousBuding wants to merge 1 commit into
Conversation
为下游网关的会话级粘性路由 (session affinity) 提供稳定会话键: conversationId 存在时注入 metadata.user_id, 缺省时不注入。 - 与 OpenAI 路径已有的 prompt_cache_key 透传语义对称 - 官方客户端 Claude Code 同样在该字段携带 session 维度 - 新增 3 用例单测 (注入/缺省/会话隔离) Co-authored-by: Claude Code <claude@vectorcontrol.tech>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
实现 #21。
变更
anthropic.ts:conversationId存在时注入params.metadata = { user_id },缺省时不注入(请求体保持不变)anthropicAffinity.test.ts:3 用例——有 conversationId 时注入 / 无时缺省 / 会话间隔离背景
prompt_cache_key: conversationId透传语义对称(同一数据、另一消费端)metadata.user_id为 Messages API 官方可选字段,官方客户端 Claude Code 亦在该字段携带 session 维度验证
vitest run src/server/tests/anthropicAffinity.test.ts3/3 通过tsc --noEmit零错误;eslint零告警