Browse Source

fix: baidu error_code 336006

HyiKi 1 năm trước cách đây
mục cha
commit
d0e296adf8
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      app/client/platforms/baidu.ts

+ 2 - 1
app/client/platforms/baidu.ts

@@ -77,7 +77,8 @@ export class ErnieApi implements LLMApi {
 
   async chat(options: ChatOptions) {
     const messages = options.messages.map((v) => ({
-      role: v.role,
+      // "error_code": 336006, "error_msg": "the role of message with odd index in the messages must be assistant",
+      role: v.role === "system" ? "assistant" : v.role,
       content: getMessageTextContent(v),
     }));