zhangqian
2024-10-25 7ee38c3bbcdd563ab941cf6a7dfa7165abb35460
app/api/report.py
@@ -4,7 +4,7 @@
import asyncio
import websockets
from sqlalchemy.orm import Session
from app.api import get_current_user_websocket, ResponseList, get_current_user
from app.api import get_current_user_websocket, ResponseList, get_current_user, format_file_url, process_files
from app.config.config import settings
from app.models.agent_model import AgentModel, AgentType
from app.models.base_model import get_db
@@ -35,7 +35,7 @@
        return websocket.send_json(ret)
    token = get_bisheng_token(db, current_user.id)
    service_uri = f"{settings.bisheng_websocket_url}/api/v1/chat/{agent_id}?type=L1&t=&chat_id={chat_id}"
    service_uri = f"{settings.sgb_websocket_url}/api/v1/chat/{agent_id}?type=L1&t=&chat_id={chat_id}"
    headers = {'cookie': f"access_token_cookie={token};"}
    await websocket.accept()
@@ -68,6 +68,7 @@
                            t = "close"
                        else:
                            t = "stream"
                        process_files(files, agent_id)
                        result = {"step_message": steps, "type": t, "files": files}
                        await websocket.send_json(result)
                        print(f"Forwarded to client, {chat_id}: {result}")
@@ -96,7 +97,7 @@
    agent = db.query(AgentModel).filter(AgentModel.id == agent_id).first()
    if not agent:
        return ResponseList(code=404, msg="Agent not found")
    bisheng_service = BishengService(base_url=settings.bisheng_base_url)
    bisheng_service = BishengService(base_url=settings.sgb_base_url)
    try:
        token = get_bisheng_token(db, current_user.id)
        result = await bisheng_service.variable_list(token, agent_id)