初始化仅前端版本
This commit is contained in:
0
backend/api/__init__.py
Normal file
0
backend/api/__init__.py
Normal file
18
backend/api/route.py
Normal file
18
backend/api/route.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from fastapi import FastAPI
|
||||
# 假设这些函数已经在其他地方定义
|
||||
from backend.core.items import ChatRequest
|
||||
from backend.tools.get_all_role_and_chat import get_all_role_and_chat as get_chat_file
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
# 1. 将输入内容持久化存储到本地jsonl方便前端读
|
||||
@app.post("/generate_reply")
|
||||
async def save_input_to_json(chat_request: ChatRequest):
|
||||
return 0
|
||||
|
||||
# 2. 从本地jsonl中读取历史对话
|
||||
@app.get("/get_all_role_and_chat")
|
||||
def get_all_role_and_chat():
|
||||
# 直接调用导入的函数
|
||||
result = get_chat_file()
|
||||
return result
|
||||
Reference in New Issue
Block a user