dsh-fish-memory 1.4.7 → 1.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +7 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1409,12 +1409,19 @@ async function 问模型(ctx, agent, 系统, 用户, 最多, 指定) {
|
|
|
1409
1409
|
return { ok: false, message: '构造消息失败:' + ((error && error.message) || error) }
|
|
1410
1410
|
}
|
|
1411
1411
|
let out = ''
|
|
1412
|
+
// ⭐ 1.4.8:**带上会话号** —— opencode 的网关(opencode.ai/zen/go)要求请求头里有
|
|
1413
|
+
// `x-opencode-session`,不带就一律 `400 MissingSessionID`(记忆就静默不生成)。
|
|
1414
|
+
// 宿主靠这个头把请求路由到「持有这段对话缓存」的节点上;插件自己发起的调用以前没带,
|
|
1415
|
+
// 所以只有普通会话能用。这里把本会话的 id 交出去,和心情插件 0.7.9 的做法一致。
|
|
1416
|
+
let 会话号 = ''
|
|
1417
|
+
try { 会话号 = sessionIdOf(agent && agent.session) } catch { 会话号 = '' }
|
|
1412
1418
|
try {
|
|
1413
1419
|
for await (const chunk of ctx.llm.stream({
|
|
1414
1420
|
provider: t.provider,
|
|
1415
1421
|
model: t.model,
|
|
1416
1422
|
system: 系统,
|
|
1417
1423
|
messages: messages,
|
|
1424
|
+
...(会话号 ? { sessionId: 会话号 } : {}),
|
|
1418
1425
|
maxTokens: 最多 || 600,
|
|
1419
1426
|
temperature: 0.1,
|
|
1420
1427
|
})) {
|