tmp
This commit is contained in:
@@ -77,10 +77,13 @@ export default class EscortAgent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mode === "messages") {
|
} else if (mode === "messages") {
|
||||||
const [message] = data;
|
const [message, metadata] = data;
|
||||||
if (message.tool_call_chunks?.length) {
|
if (message.tool_call_chunks?.length) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (metadata?.lcSource === "summarization" || metadata?.lc_source === "summarization") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (AIMessageChunk.isInstance(message)) {
|
if (AIMessageChunk.isInstance(message)) {
|
||||||
if (message.text && !message.tool_call_chunks?.length) {
|
if (message.text && !message.tool_call_chunks?.length) {
|
||||||
callback(source, "ai", message.text, message.id);
|
callback(source, "ai", message.text, message.id);
|
||||||
@@ -103,12 +106,14 @@ export default class EscortAgent {
|
|||||||
return this.agent;
|
return this.agent;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.messages = [];
|
|
||||||
|
|
||||||
const rootDir = process.cwd();
|
const rootDir = process.cwd();
|
||||||
|
this.messages = [];
|
||||||
|
let backend = new FilesystemBackend({ rootDir });
|
||||||
|
|
||||||
|
if (userInfo) {
|
||||||
const userMemoryPath = path.join(rootDir, "data", userInfo._id, "memories");
|
const userMemoryPath = path.join(rootDir, "data", userInfo._id, "memories");
|
||||||
console.log(userMemoryPath);
|
console.log(userMemoryPath);
|
||||||
const backend = new CompositeBackend(
|
backend = new CompositeBackend(
|
||||||
new FilesystemBackend({ rootDir }),
|
new FilesystemBackend({ rootDir }),
|
||||||
{
|
{
|
||||||
"/memories/": new FilesystemBackend({
|
"/memories/": new FilesystemBackend({
|
||||||
@@ -117,6 +122,7 @@ export default class EscortAgent {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
this.flashModel = new ChatDeepSeek({
|
this.flashModel = new ChatDeepSeek({
|
||||||
model: 'deepseek-v4-flash',
|
model: 'deepseek-v4-flash',
|
||||||
@@ -139,13 +145,6 @@ export default class EscortAgent {
|
|||||||
getCalendarInfoTool, getLunarCalendarInfoTool, getYearHolidaysTool, getYearTermsTool,
|
getCalendarInfoTool, getLunarCalendarInfoTool, getYearHolidaysTool, getYearTermsTool,
|
||||||
createEscortRecordQueryTool(userInfo)],
|
createEscortRecordQueryTool(userInfo)],
|
||||||
skills: ["./agent/escort/skills/"],
|
skills: ["./agent/escort/skills/"],
|
||||||
middleware: [
|
|
||||||
summarizationMiddleware({
|
|
||||||
model: this.flashModel,
|
|
||||||
trigger: { tokens: 5000 },
|
|
||||||
keep: { messages: 10 },
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return this.agent;
|
return this.agent;
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ export default class WebSocketServerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getUserInfo(token, userId) {
|
async getUserInfo(token, userId) {
|
||||||
|
try {
|
||||||
if (!token && !userId) return null;
|
if (!token && !userId) return null;
|
||||||
|
|
||||||
const url = "http://127.0.0.1:9010/user/userInfo";
|
const url = "http://127.0.0.1:9010/user/userInfo";
|
||||||
@@ -147,5 +148,9 @@ export default class WebSocketServerManager {
|
|||||||
});
|
});
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
return data.data.user;
|
return data.data.user;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching user info:', error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user