Repository navigation
Conversation
- 根因:两处 `llm.stream` 只带 `sessionId: 'dsh-pet'`,不带调用性质。代理只能按内容猜——billion-context 对 dsh 插件流量按 system 指纹分车道,而碎碎念的 system 含实时时间(`timeContextOf()` 现算), 指纹每条都变,于是每条碎碎念派生一条 `dsh-pet|sub:<fp>` 会话;实测 1148 条会话里 956 条是这种 1 请求记录。 - 实现:`llm-call.ts` 新增 `PET_WHISPER_PURPOSE` / `PET_CHAT_PURPOSE`,两处调用把 dsh-llm 的 `GenerateOptions.purpose` 一起传下去。代理据此走 side 车道并归并到调用身份(billion-context #6880 / #6883)。 - 行为变化:只多一个透传字段。dsh-llm 运行时不做 purpose 校验(纯透传),不认识该字段的代理直接忽略, 不使用 billion-context 的部署无变化;`sessionId` 保持不变(缺它时 opencode-go 回 400)。 - 测试:新增 `src/host/llm-call.test.ts`,钉住声明值必须能进请求头(可打印 ASCII、≤64)且不等于代理保留值 `conversation`(等值会被丢弃,问题静默复发)。 - 涉及文件:`src/host/llm-call.ts`、`src/host/whisper.ts`、`src/host/chat.ts`、`src/host/llm-call.test.ts`
This branch has not been deployed
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.
问题
碎碎念(whisper)每
whisper秒(默认 300)调一次模型,陪聊同理。两处调用都只带sessionId: 'dsh-pet',不声明这次调用是什么性质。在装了 billion-context 的 DSH 里,代理只能按内容猜:它对 dsh 插件流量按
system指纹分车道,而碎碎念的system由composeSystemPrompt拼入实时时间(timeContextOf()现算、不缓存),指纹每次都变,于是每条碎碎念都派生出一条dsh-pet|sub:<fp>独立会话。实测(billion-context
0.1.216,DSH0.2.2-rc.1):会话列表按
lastSeen倒序,5 分钟一条的碎碎念把正常会话逐页挤到后面。改动
src/host/llm-call.ts新增两个常量,whisper.ts/chat.ts把 dsh-llm 的GenerateOptions.purpose一起传下去:为什么用
purpose而不是改 prompt / 改 sessionIdpurpose就是 dsh-llm 为辅助调用准备的原生字段(GenerateOptions.purpose,注释原文:Provider-neutral classification for an auxiliary model call. Ordinary conversation requests leave it unset.),dsh 自己的session-title、compaction、auto-review都是这么声明的。isSideRequest()里purpose非空即判为 side,短路 persona 指纹那条分车道分支,会话 id 回到请求头里的dsh-pet;实现 PR #6883 已合并(0.1.216起)。顺手的好处:purpose也不再参与压缩守卫的文本匹配。sessionId保持不变:它是调用身份(注释里写了,缺它时 opencode-go 回 400),不是「会话」语义;这里缺的是调用性质。purpose校验(0.2.2-rc.1里零处引用),纯透传;不认识该字段的代理直接忽略这个多出来的属性。验证
pnpm run typecheck、eslint、prettier --check、pnpm test(2750 通过)本地全绿。src/host/llm-call.test.ts,钉住约束:两个声明值必须能原样进请求头(可打印 ASCII、长度 ≤64),互不相同,且都不等于代理保留值conversation(等值会被丢弃,分车道问题静默复发)。预期:只剩一条
dsh-pet,requests随时间递增,不再出现新的|sub:记录。存量记录不会被清理(代理没有删除路由),但停止增长后它们会自然沉底。关联
billion-context/bili/purpose/sessionId/会话列表等关键词均无命中);碎碎念消耗token太多 #276 / 系统锁定后,插件仍然周期执行碎碎念调度 #337 /whisperEnabled: false不能阻止梦话:宠物睡眠期间仍按sleepTalk(默认 60s)调用模型 #355 虽都涉及 whisper,但分别是额度消耗、调度时机与开关语义。