fix nextchapter bug

This commit is contained in:
Cai
2025-10-27 11:08:46 +08:00
parent b921bda4bc
commit 33bf569fb0
4 changed files with 1138 additions and 6 deletions

1132
Html/.log

File diff suppressed because one or more lines are too long

View File

@@ -8,12 +8,12 @@ current_directory = os.path.dirname(os.path.abspath(__file__))
sys.path.append(current_directory)
from flask_socketio import SocketIO, join_room, emit, Namespace
import os
from ...function_tools.function_manager import FunctionManager
from apps.function_tools.function_manager import FunctionManager
from dataclasses import dataclass, field
from typing import Dict, Optional
import subprocess
import threading
from ...utils import *
from apps.utils import *
EMPTY_CHAPTER_CHAIN = [ Chapter(1, CHAPTER_FOCUS, "本章是未打开某个具体章节时的默认章节。", "处于本章节时不会有任何章节跳转。请作为一名经验丰富的算法教师,回答用户的问题。") ]
@dataclass

View File

@@ -155,7 +155,7 @@ class AgentNamespace(Namespace):
if data['type'] == 'function': # 在这里 前端会发送允许执行的function与参数
print("function_call", data['data'])
d = data['data']
res = chatmanager[uuid].function_call(d['data']['name'], d['data']['args'])
res = chatmanager[uuid].function_call(d['data']['name'], d['data'].get('args', {}))
d['data'] = res.to_dict()
print("function_call_res", d['data'])
emit(d['route'], d, room=uuid, namespace='/agent')
@@ -234,7 +234,6 @@ class AgentNamespace(Namespace):
emit('message', res.message, room=uuid, namespace='/agent')
def on_disconnect(self,data):
ex = current_app.extensions
uuid = session.get('user_uuid')

View File

@@ -3,8 +3,9 @@ var socket;
let system_message_idx = 0
document.addEventListener('DOMContentLoaded', function () {
data = window.appData;
console.log(data);
socket = io('/agent', {
const host = window.location.host;
console.log(`Connecting to WebSocket server at wss://${host}/agent`);
socket = io(`wss://${host}/agent`, {
query: {
user_uuid: data.user_uuid,
folder: data.folder