start
This commit is contained in:
29
agent/escort/task.js
Normal file
29
agent/escort/task.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import EscortAgent from "./agent.js";
|
||||
|
||||
class ChatTask {
|
||||
constructor(options = {}) {
|
||||
this.options = {
|
||||
modelProvider: options.modelProvider || "deepseek",
|
||||
apiKey: options.apiKey,
|
||||
baseURL: options.baseURL,
|
||||
modelName: options.modelName,
|
||||
temperature: options.temperature ?? 0.7,
|
||||
maxIterations: options.maxIterations || 10,
|
||||
};
|
||||
|
||||
this.agents = {};
|
||||
}
|
||||
|
||||
async streamChat(userInfo, message, callback) {
|
||||
const userId = userInfo ? userInfo._id : message.appId;
|
||||
if (!this.agents[userId]) {
|
||||
this.agents[userId] = new EscortAgent();
|
||||
}
|
||||
return this.agents[userId].streamChat(userInfo, [message], callback);
|
||||
}
|
||||
}
|
||||
|
||||
const chatTask = new ChatTask();
|
||||
|
||||
export { ChatTask, chatTask };
|
||||
export default chatTask;
|
||||
Reference in New Issue
Block a user