From 0bdec54c23c5337622ae4a43cc9f1354003b7ecd Mon Sep 17 00:00:00 2001 From: martsforever Date: Fri, 27 Mar 2026 14:43:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=A8=A1=E5=9E=8B=E8=B0=83=E7=94=A8?= =?UTF-8?q?=EF=BC=8C=E4=BB=A5=E5=8F=8A=E6=A8=A1=E5=9E=8B=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E4=BB=A3=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/main.py b/main.py index ed8f5a2..4c071b2 100644 --- a/main.py +++ b/main.py @@ -75,6 +75,35 @@ async def redirect_root_to_docs(): return RedirectResponse("/docs") +@app.get("/chat") +async def chat(): + model = init_chat_model( + model="qwen2.5-vl-7b-instruct", # 你的模型名 + model_provider="openai", # 必须填 openai(兼容协议) + base_url="http://127.0.0.1:1234/v1", # 你的自定义 API URL + api_key="1234", # 本地模型随便填 + temperature=0.7, + ) + output = model.invoke("你好").content + + print(f"output:{output}") + return output + + +# Edit this to add the chain you want to add +# add_routes(app, NotImplemented) + +model = init_chat_model( + model="doubao-1-5-pro-32k-250115", # 你的模型名 + model_provider="openai", # 必须填 openai(兼容协议) + base_url="https://ark.cn-beijing.volces.com/api/v3/", # 你的自定义 API URL + api_key="b1e7c7e0-33af-480e-b0a8-2812ba97f7b1", # 本地模型随便填 + temperature=0.7, + streaming=False +) + +add_routes(app=app,runnable=model,path="/qwen") + if __name__ == "__main__": import uvicorn