Merge pull request #8 from Hk-Gosuto/dev

支持 ChatSession 级别插件功能开关
This commit is contained in:
Hk-Gosuto
2023-08-12 00:56:18 +08:00
committed by GitHub
10 changed files with 117 additions and 129 deletions

View File

@@ -68,6 +68,7 @@ async function handle(req: NextRequest) {
const handler = BaseCallbackHandler.fromMethods({
async handleLLMNewToken(token: string) {
if (token) {
console.log("[Token]", token);
var response = new ResponseBody();
response.message = token;
await writer.ready;
@@ -199,13 +200,13 @@ async function handle(req: NextRequest) {
presencePenalty: reqBody.presence_penalty,
frequencyPenalty: reqBody.frequency_penalty,
});
const executor = await initializeAgentExecutorWithOptions(tools, llm, {
agentType: "openai-functions",
returnIntermediateSteps: true,
maxIterations: 3,
memory: memory,
});
executor.call(
{
input: reqBody.messages.slice(-1)[0].content,