dsh-line-bot 0.4.0 → 0.4.1
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/CHANGELOG.md +5 -0
- package/lib/host.mjs +17 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/lib/host.mjs
CHANGED
|
@@ -34,7 +34,7 @@ const { createBalanceMonitor } = balanceMod
|
|
|
34
34
|
const { createMemoryStore } = memoryMod
|
|
35
35
|
const { chunkText, clip, inQuietWindow, jsonFail, jsonOk, maskSecret, readJsonBody, safeArray } = utilMod
|
|
36
36
|
|
|
37
|
-
export const VERSION = '0.4.
|
|
37
|
+
export const VERSION = '0.4.1'
|
|
38
38
|
|
|
39
39
|
// 環境變數提供的 Cloudflare API Token(方便用 shell 注入、不用把 token 寫進設定檔)。
|
|
40
40
|
// 設定檔裡的 token 優先;兩者都沒有時才用環境變數。
|
|
@@ -253,6 +253,21 @@ export async function create({ ctx, config: pluginConfig, logger: upstream }) {
|
|
|
253
253
|
return lines.join('\n')
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
+
function modelContextText() {
|
|
257
|
+
const sel = modelSelection()
|
|
258
|
+
if (!sel.provider || !sel.model) return ''
|
|
259
|
+
const value = modelCache?.value
|
|
260
|
+
const providerInfo = (value?.providers || []).find((item) => item.id === sel.provider)
|
|
261
|
+
const modelInfo = (providerInfo?.models || []).find((item) => item.id === sel.model)
|
|
262
|
+
const providerName = providerInfo?.name || sel.provider
|
|
263
|
+
const modelName = modelInfo?.name || sel.model
|
|
264
|
+
const effort = String(store.get().agent?.reasoningEffort || '').trim()
|
|
265
|
+
return [
|
|
266
|
+
'【目前使用的模型】' + sel.provider + (providerName !== sel.provider ? '(' + providerName + ')' : '') + '/' + sel.model + (modelName !== sel.model ? '(' + modelName + ')' : '') + (effort ? ',推理強度 ' + effort : '') + '。',
|
|
267
|
+
'如果主人問你「你是哪個模型」、「用什麼模型回答」,就照這一行回答模型與來源;只講這兩個,不要加推測或額外解釋,也不要說成別的模型,不用提這是插件提供的背景資訊。',
|
|
268
|
+
].join('\n')
|
|
269
|
+
}
|
|
270
|
+
|
|
256
271
|
function memoryRulesText() {
|
|
257
272
|
if (store.get().memory?.enabled === false) return ''
|
|
258
273
|
return [
|
|
@@ -284,7 +299,7 @@ export async function create({ ctx, config: pluginConfig, logger: upstream }) {
|
|
|
284
299
|
}
|
|
285
300
|
|
|
286
301
|
function agentContextText(userId) {
|
|
287
|
-
return [tiebaContextText(), balanceContextText(), memoryContextText(userId)].filter(Boolean).join('\n\n')
|
|
302
|
+
return [modelContextText(), tiebaContextText(), balanceContextText(), memoryContextText(userId)].filter(Boolean).join('\n\n')
|
|
288
303
|
}
|
|
289
304
|
|
|
290
305
|
async function refreshBalance() {
|