Browse Source

add frontend display, more model

creamlike1024 7 months ago
parent
commit
59aabb4311

+ 23 - 1
relay/channel/coze/constants.go

@@ -1,8 +1,30 @@
 package coze
 
 var ModelList = []string{
-	// TODO: 完整列表
+	"moonshot-v1-8k",
+	"moonshot-v1-32k",
+	"moonshot-v1-128k",
+	"Baichuan4",
+	"abab6.5s-chat-pro",
+	"glm-4-0520",
+	"qwen-max",
+	"deepseek-r1",
 	"deepseek-v3",
+	"deepseek-r1-distill-qwen-32b",
+	"deepseek-r1-distill-qwen-7b",
+	"step-1v-8k",
+	"step-1.5v-mini",
+	"Doubao-pro-32k",
+	"Doubao-pro-256k",
+	"Doubao-lite-128k",
+	"Doubao-lite-32k",
+	"Doubao-vision-lite-32k",
+	"Doubao-vision-pro-32k",
+	"Doubao-1.5-pro-vision-32k",
+	"Doubao-1.5-lite-32k",
+	"Doubao-1.5-pro-32k",
+	"Doubao-1.5-thinking-pro",
+	"Doubao-1.5-pro-256k",
 }
 
 var ChannelName = "coze"

+ 6 - 3
relay/channel/coze/relay-coze.go

@@ -28,10 +28,13 @@ func convertCozeChatRequest(c *gin.Context, request dto.GeneralOpenAIRequest) *C
 			})
 		}
 	}
+	user := request.User
+	if user == "" {
+		user = helper.GetResponseID(c)
+	}
 	cozeRequest := &CozeChatRequest{
-		// TODO: model to botid
 		BotId:              c.GetString("bot_id"),
-		UserId:             c.GetString("id"),
+		UserId:             user,
 		AdditionalMessages: messages,
 		Stream:             request.Stream,
 	}
@@ -172,6 +175,6 @@ func doRequest(req *http.Request, info *common.RelayInfo) (*http.Response, error
 	if err != nil { // 增加对 client.Do(req) 返回错误的检查
 		return nil, fmt.Errorf("client.Do failed: %w", err)
 	}
-	_ = resp.Body.Close()
+	// _ = resp.Body.Close()
 	return resp, nil
 }

+ 7 - 2
web/src/constants/channel.constants.js

@@ -118,6 +118,11 @@ export const CHANNEL_OPTIONS = [
   {
     value: 48,
     color: 'blue',
-    label: 'xAI'
-  }
+    label: 'xAI',
+  },
+  {
+    value: 49,
+    color: 'blue',
+    label: 'Coze',
+  },
 ];

+ 16 - 0
web/src/pages/Channel/EditChannel.js

@@ -838,6 +838,22 @@ const EditChannel = (props) => {
               />
             </>
           )}
+          {inputs.type === 49 && (
+            <>
+              <div style={{ marginTop: 10 }}>
+                <Typography.Text strong>智能体ID:</Typography.Text>
+              </div>
+              <Input
+                name='other'
+                placeholder={'请输入智能体ID,例如:7342866812345'}
+                onChange={(value) => {
+                  handleInputChange('other', value);
+                }}
+                value={inputs.other}
+                autoComplete='new-password'
+              />
+            </>
+          )}
           <div style={{ marginTop: 10 }}>
             <Typography.Text strong>{t('模型')}:</Typography.Text>
           </div>