From 7ba8a57793820f5ec893bcc45184a8693083ee2b Mon Sep 17 00:00:00 2001 From: Liujian <824010343@qq.com> Date: Tue, 22 Apr 2025 18:08:24 +0800 Subject: [PATCH] Fix: Apikey getting md5 when calling MCP Server at service level --- mcp-server/tool.go | 2 +- module/ai/iml.go | 3 ++- module/mcp/iml.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mcp-server/tool.go b/mcp-server/tool.go index b7bddd04..bc07ff74 100644 --- a/mcp-server/tool.go +++ b/mcp-server/tool.go @@ -124,7 +124,7 @@ func (t *Tool) RegisterMCP(s *server.MCPServer) { } apikey := utils.Label(ctx, "apikey") if apikey != "" { - req.Header.Set("Authorization", utils.Md5(apikey)) + req.Header.Set("Authorization", apikey) } resp, err := client.Do(req) diff --git a/module/ai/iml.go b/module/ai/iml.go index d3d9b535..5c73dfeb 100644 --- a/module/ai/iml.go +++ b/module/ai/iml.go @@ -718,7 +718,8 @@ func (i *imlProviderModule) getAiProviders(ctx context.Context) ([]*gateway.Dyna } model, has := driver.GetModel(l.DefaultLLM) if !has { - return nil, fmt.Errorf("model not found: %s", l.DefaultLLM) + continue + //return nil, fmt.Errorf("model not found: %s", l.DefaultLLM) } cfg := make(map[string]interface{}) cfg["provider"] = l.Id diff --git a/module/mcp/iml.go b/module/mcp/iml.go index 6a88ffd6..9e2af616 100644 --- a/module/mcp/iml.go +++ b/module/mcp/iml.go @@ -270,7 +270,7 @@ func (i *imlMcpModule) Invoke(ctx context.Context, req mcp.CallToolRequest) (*mc queryParam.Add(k, value) } case float64: - queryParam.Add(k, strconv.FormatFloat(v, 'e', -1, 64)) + queryParam.Add(k, strconv.FormatFloat(v, 'f', -1, 64)) default: return nil, fmt.Errorf("invalid query param type: %T", v) }