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:
+7
-8
@@ -16384,7 +16384,7 @@ function G3(t, e2) {
|
||||
// package.json
|
||||
var package_default = {
|
||||
name: "opencommit",
|
||||
version: "3.0.10",
|
||||
version: "3.0.11",
|
||||
description: "Auto-generate impressive commits in 1 second. Killing lame commits with AI \u{1F92F}\u{1F52B}",
|
||||
keywords: [
|
||||
"git",
|
||||
@@ -21991,12 +21991,11 @@ var api = new OpenAi();
|
||||
var OllamaAi = class {
|
||||
async generateCommitMessage(messages) {
|
||||
const model = "mistral";
|
||||
let prompt = messages.map((x4) => x4.content).join("\n");
|
||||
prompt += "Summarize above git diff in 10 words or less";
|
||||
const url3 = "http://localhost:11434/api/generate";
|
||||
const url3 = "http://localhost:11434/api/chat";
|
||||
const p4 = {
|
||||
model,
|
||||
prompt,
|
||||
messages,
|
||||
options: { temperature: 0, top_p: 0.1 },
|
||||
stream: false
|
||||
};
|
||||
try {
|
||||
@@ -22005,8 +22004,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);
|
||||
@@ -22661,7 +22660,7 @@ var hookCommand = G3(
|
||||
return ce(`${source_default.green("\u2714")} Hook is removed`);
|
||||
}
|
||||
throw new Error(
|
||||
`Unsupported mode: ${mode2}. Supported modes are: 'set' or 'unset'`
|
||||
`Unsupported mode: ${mode2}. Supported modes are: 'set' or 'unset', do: \`oco hook set\``
|
||||
);
|
||||
} catch (error) {
|
||||
ce(`${source_default.red("\u2716")} ${error}`);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user