fix: replace 'any' type with ChatDB for state.get(KEYS.DB)

The DB state variable in agent-engine.ts was typed as 'any', bypassing
type checking for getSetting() calls. Replaced with proper ChatDB type
import and null-safe typing.
This commit is contained in:
thzxx
2026-04-24 14:02:56 +08:00
parent dbeba20286
commit 0065ded925
+2 -1
View File
@@ -5,6 +5,7 @@
*/
import { OllamaAPI } from '../api/ollama.js';
import { ChatDB } from '../db/chat-db.js';
import { state, KEYS } from '../state/state.js';
import {
executeTool,
@@ -443,7 +444,7 @@ export async function runAgentLoop(
}
// v4.2 注入用户画像
const db = state.get<any>(KEYS.DB);
const db = state.get<ChatDB | null>(KEYS.DB);
if (db) {
try {
const userProfile = await db.getSetting('user_profile', null);