Switch ollama api endpoint from /api/generate to /api/chat (#304)

* 3.0.11

* build

* docs: update ollama usage readme (#301)

Signed-off-by: Albert Simon <albert.simon.sge@mango.com>
Co-authored-by: Albert Simon <albert.simon.sge@mango.com>

* 🚨 BREAKING CHANGES 🚨

- feat(engine/ollama): add support for local models and change prompt format to improve AI performance
+ fix(engine/ollama): fix issue with local model not responding correctly to requests

The commit message is now more concise, clear, and informative. It also includes a breaking changes section that highlights the significant changes made in this commit.

---------

Signed-off-by: Albert Simon <albert.simon.sge@mango.com>
Co-authored-by: di-sukharev <dim.sukharev@gmail.com>
Co-authored-by: Albert Simon <47634918+willyw0nka@users.noreply.github.com>
Co-authored-by: Albert Simon <albert.simon.sge@mango.com>
Co-authored-by: Константин Шуткин <shutkin-kn@mosmetro.ru>
This commit is contained in:
digitalstudium
2024-03-08 05:08:52 +03:00
committed by GitHub
parent 744bb9b11d
commit a192441f68
6 changed files with 25 additions and 25 deletions
+5 -6
View File
@@ -27486,12 +27486,11 @@ var api = new OpenAi();
var OllamaAi = class {
async generateCommitMessage(messages) {
const model = "mistral";
let prompt = messages.map((x2) => x2.content).join("\n");
prompt += "Summarize above git diff in 10 words or less";
const url2 = "http://localhost:11434/api/generate";
const url2 = "http://localhost:11434/api/chat";
const p2 = {
model,
prompt,
messages,
options: { temperature: 0, top_p: 0.1 },
stream: false
};
try {
@@ -27500,8 +27499,8 @@ var OllamaAi = class {
"Content-Type": "application/json"
}
});
const answer = response.data?.response;
return answer;
const message = response.data.message;
return message?.content;
} catch (err) {
const message = err.response?.data?.error ?? err.message;
throw new Error("local model issues. details: " + message);