Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ollamaloglog #5973

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions apps/desktop/src/lib/ai/ollamaClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,22 @@ ${JSON.stringify(OLLAMA_CHAT_MESSAGE_FORMAT_SCHEMA, null, 2)}`
* @returns A Promise that resolves to the Response object.
*/
private async fetchChat(request: OllamaChatRequest): Promise<unknown> {
console.log(request);
const url = new URL(OllamaAPEndpoint.Chat, this.endpoint);
console.log(url);
const body = JSON.stringify(request);
console.log(body);

return await fetch(url.toString(), {
const response = await fetch(url.toString(), {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body
}).then(async (response) => await response.json());
});
console.log(response);

return await response.json();
}

/**
Expand All @@ -163,6 +169,7 @@ ${JSON.stringify(OLLAMA_CHAT_MESSAGE_FORMAT_SCHEMA, null, 2)}`
options,
format: 'json'
});
console.log(result);

if (!isOllamaChatResponse(result)) {
throw new Error('Invalid response\n' + JSON.stringify(result));
Expand Down
Loading