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:
@@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { OllamaAPI } from '../api/ollama.js';
|
import { OllamaAPI } from '../api/ollama.js';
|
||||||
|
import { ChatDB } from '../db/chat-db.js';
|
||||||
import { state, KEYS } from '../state/state.js';
|
import { state, KEYS } from '../state/state.js';
|
||||||
import {
|
import {
|
||||||
executeTool,
|
executeTool,
|
||||||
@@ -443,7 +444,7 @@ export async function runAgentLoop(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// v4.2 注入用户画像
|
// v4.2 注入用户画像
|
||||||
const db = state.get<any>(KEYS.DB);
|
const db = state.get<ChatDB | null>(KEYS.DB);
|
||||||
if (db) {
|
if (db) {
|
||||||
try {
|
try {
|
||||||
const userProfile = await db.getSetting('user_profile', null);
|
const userProfile = await db.getSetting('user_profile', null);
|
||||||
|
|||||||
Reference in New Issue
Block a user