From a32e73efef8031402f20758c71337a35fb39d847 Mon Sep 17 00:00:00 2001 From: Seefs Date: Sun, 25 Jan 2026 00:02:16 +0800 Subject: [PATCH 1/2] fix: test using the correct path for rerank. --- common/endpoint_defaults.go | 2 +- controller/channel-test.go | 14 ++++++++++++++ .../table/channels/modals/ModelTestModal.jsx | 2 +- .../table/models/modals/EditModelModal.jsx | 2 +- .../table/models/modals/EditPrefillGroupModal.jsx | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/common/endpoint_defaults.go b/common/endpoint_defaults.go index c04c5f6d8e0e..6717a22fdd08 100644 --- a/common/endpoint_defaults.go +++ b/common/endpoint_defaults.go @@ -21,7 +21,7 @@ var defaultEndpointInfoMap = map[constant.EndpointType]EndpointInfo{ constant.EndpointTypeOpenAIResponse: {Path: "/v1/responses", Method: "POST"}, constant.EndpointTypeAnthropic: {Path: "/v1/messages", Method: "POST"}, constant.EndpointTypeGemini: {Path: "/v1beta/models/{model}:generateContent", Method: "POST"}, - constant.EndpointTypeJinaRerank: {Path: "/rerank", Method: "POST"}, + constant.EndpointTypeJinaRerank: {Path: "/v1/rerank", Method: "POST"}, constant.EndpointTypeImageGeneration: {Path: "/v1/images/generations", Method: "POST"}, constant.EndpointTypeEmbeddings: {Path: "/v1/embeddings", Method: "POST"}, } diff --git a/controller/channel-test.go b/controller/channel-test.go index 2ae8b0ef65e8..e255cb62fa1a 100644 --- a/controller/channel-test.go +++ b/controller/channel-test.go @@ -84,6 +84,11 @@ func testChannel(channel *model.Channel, testModel string, endpointType string) } } else { // 如果没有指定端点类型,使用原有的自动检测逻辑 + + if strings.Contains(strings.ToLower(testModel), "rerank") { + requestPath = "/v1/rerank" + } + // 先判断是否为 Embedding 模型 if strings.Contains(strings.ToLower(testModel), "embedding") || strings.HasPrefix(testModel, "m3e") || // m3e 系列模型 @@ -479,6 +484,15 @@ func buildTestRequest(model string, endpointType string, channel *model.Channel) } // 自动检测逻辑(保持原有行为) + if strings.Contains(strings.ToLower(model), "rerank") { + return &dto.RerankRequest{ + Model: model, + Query: "What is Deep Learning?", + Documents: []any{"Deep Learning is a subset of machine learning.", "Machine learning is a field of artificial intelligence."}, + TopN: 2, + } + } + // 先判断是否为 Embedding 模型 if strings.Contains(strings.ToLower(model), "embedding") || strings.HasPrefix(model, "m3e") || diff --git a/web/src/components/table/channels/modals/ModelTestModal.jsx b/web/src/components/table/channels/modals/ModelTestModal.jsx index b923d1096846..9556d56b77f8 100644 --- a/web/src/components/table/channels/modals/ModelTestModal.jsx +++ b/web/src/components/table/channels/modals/ModelTestModal.jsx @@ -71,7 +71,7 @@ const ModelTestModal = ({ value: 'gemini', label: 'Gemini (/v1beta/models/{model}:generateContent)', }, - { value: 'jina-rerank', label: 'Jina Rerank (/rerank)' }, + { value: 'jina-rerank', label: 'Jina Rerank (/v1/rerank)' }, { value: 'image-generation', label: t('图像生成') + ' (/v1/images/generations)', diff --git a/web/src/components/table/models/modals/EditModelModal.jsx b/web/src/components/table/models/modals/EditModelModal.jsx index bed614bf0c65..727a8e4e8e29 100644 --- a/web/src/components/table/models/modals/EditModelModal.jsx +++ b/web/src/components/table/models/modals/EditModelModal.jsx @@ -47,7 +47,7 @@ const ENDPOINT_TEMPLATE = { 'openai-response': { path: '/v1/responses', method: 'POST' }, anthropic: { path: '/v1/messages', method: 'POST' }, gemini: { path: '/v1beta/models/{model}:generateContent', method: 'POST' }, - 'jina-rerank': { path: '/rerank', method: 'POST' }, + 'jina-rerank': { path: '/v1/rerank', method: 'POST' }, 'image-generation': { path: '/v1/images/generations', method: 'POST' }, }; diff --git a/web/src/components/table/models/modals/EditPrefillGroupModal.jsx b/web/src/components/table/models/modals/EditPrefillGroupModal.jsx index 1ca5e64726c8..817ae40dd225 100644 --- a/web/src/components/table/models/modals/EditPrefillGroupModal.jsx +++ b/web/src/components/table/models/modals/EditPrefillGroupModal.jsx @@ -45,7 +45,7 @@ const ENDPOINT_TEMPLATE = { 'openai-response': { path: '/v1/responses', method: 'POST' }, anthropic: { path: '/v1/messages', method: 'POST' }, gemini: { path: '/v1beta/models/{model}:generateContent', method: 'POST' }, - 'jina-rerank': { path: '/rerank', method: 'POST' }, + 'jina-rerank': { path: '/v1/rerank', method: 'POST' }, 'image-generation': { path: '/v1/images/generations', method: 'POST' }, }; From e27c720f5477f5fe91e638e153a1ebf0efe78a01 Mon Sep 17 00:00:00 2001 From: Seefs Date: Sun, 25 Jan 2026 00:05:05 +0800 Subject: [PATCH 2/2] fix: The `input` parameter for testing responses uses an array to accommodate certain channels, such as Codex, which are incompatible with single strings. --- controller/channel-test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controller/channel-test.go b/controller/channel-test.go index e255cb62fa1a..b3ccac89015d 100644 --- a/controller/channel-test.go +++ b/controller/channel-test.go @@ -461,7 +461,7 @@ func buildTestRequest(model string, endpointType string, channel *model.Channel) // 返回 OpenAIResponsesRequest return &dto.OpenAIResponsesRequest{ Model: model, - Input: json.RawMessage("\"hi\""), + Input: json.RawMessage(`[{"role":"user","content":"hi"}]`), } case constant.EndpointTypeAnthropic, constant.EndpointTypeGemini, constant.EndpointTypeOpenAI: // 返回 GeneralOpenAIRequest @@ -508,7 +508,7 @@ func buildTestRequest(model string, endpointType string, channel *model.Channel) if strings.Contains(strings.ToLower(model), "codex") { return &dto.OpenAIResponsesRequest{ Model: model, - Input: json.RawMessage("\"hi\""), + Input: json.RawMessage(`[{"role":"user","content":"hi"}]`), } }