diff --git a/src/libs/agent-runtime/huggingface/index.ts b/src/libs/agent-runtime/huggingface/index.ts index b31a12b1af27..552652f9470a 100644 --- a/src/libs/agent-runtime/huggingface/index.ts +++ b/src/libs/agent-runtime/huggingface/index.ts @@ -1,4 +1,5 @@ import { HfInference } from '@huggingface/inference'; +import urlJoin from 'url-join'; import { AgentRuntimeErrorType } from '../error'; import { ModelProvider } from '../types'; @@ -23,7 +24,9 @@ export const LobeHuggingFaceAI = LobeOpenAICompatibleFactory({ createChatCompletionStream: (client: HfInference, payload, instance) => { const { max_tokens = 4096} = payload; const hfRes = client.chatCompletionStream({ - endpointUrl: instance.baseURL, + endpointUrl: instance.baseURL + ? urlJoin(instance.baseURL, payload.model) + : instance.baseURL, max_tokens: max_tokens, messages: payload.messages, model: payload.model,