fix: update ollama api

This commit is contained in:
Gabe
2025-09-03 14:02:55 +08:00
parent 6dd6b73c2f
commit b631703aa6
2 changed files with 16 additions and 4 deletions

View File

@@ -554,6 +554,8 @@ const genOllama = ({
systemPrompt, systemPrompt,
userPrompt, userPrompt,
model, model,
temperature,
maxTokens,
customHeader, customHeader,
customBody, customBody,
docInfo, docInfo,
@@ -565,9 +567,19 @@ const genOllama = ({
const data = { const data = {
model, model,
system: systemPrompt, messages: [
prompt: userPrompt, {
think: think, role: "system",
content: systemPrompt,
},
{
role: "user",
content: userPrompt,
},
],
temperature,
max_tokens: maxTokens,
think,
stream: false, stream: false,
...customBody, ...customBody,
}; };

View File

@@ -379,7 +379,7 @@ const defaultOpenaiApi = {
}; };
const defaultOllamaApi = { const defaultOllamaApi = {
...defaultApi, ...defaultApi,
url: "http://localhost:11434/api/generate", url: "http://localhost:11434/v1/chat/completions",
model: "llama3.1", model: "llama3.1",
}; };
export const DEFAULT_TRANS_APIS = { export const DEFAULT_TRANS_APIS = {