浏览代码

fix: chat completed

Timothy J. Baek 11 月之前
父节点
当前提交
995f7bc51b
共有 2 个文件被更改,包括 11 次插入1 次删除
  1. 10 0
      backend/main.py
  2. 1 1
      src/lib/components/chat/Chat.svelte

+ 10 - 0
backend/main.py

@@ -271,6 +271,11 @@ class PipelineMiddleware(BaseHTTPMiddleware):
                 except:
                     pass
 
+            model = app.state.MODELS[model_id]
+
+            if "pipeline" in model:
+                sorted_filters.append(model)
+
             for filter in sorted_filters:
                 r = None
                 try:
@@ -490,6 +495,11 @@ async def chat_completed(form_data: dict, user=Depends(get_verified_user)):
     ]
     sorted_filters = sorted(filters, key=lambda x: x["pipeline"]["priority"])
 
+    model = app.state.MODELS[model_id]
+
+    if "pipeline" in model:
+        sorted_filters = [model] + sorted_filters
+
     for filter in sorted_filters:
         r = None
         try:

+ 1 - 1
src/lib/components/chat/Chat.svelte

@@ -899,7 +899,7 @@
 							const messages = createMessagesList(responseMessageId);
 
 							const res = await chatCompleted(localStorage.token, {
-								model: model,
+								model: model.id,
 								messages: messages.map((m) => ({
 									id: m.id,
 									role: m.role,