AI works here

This commit is contained in:
2026-04-30 12:48:29 -04:00
parent 92024c8a64
commit 6f4519894b
16 changed files with 1793 additions and 303 deletions
+9 -3
View File
@@ -2,6 +2,8 @@
const axios = require('axios');
axios.defaults.timeout = 0;
class OllamaProvider {
constructor(config) {
this.config = config;
@@ -25,11 +27,13 @@ class OllamaProvider {
top_p: this.config.topP || 0.95,
top_k: this.config.topK || 64,
num_predict: this.config.maxOutputTokens || 2048,
};
}
__jsonFormat() {
return {
return 'json'
/* return {
type: 'array',
items: {
type: 'object',
@@ -39,7 +43,7 @@ class OllamaProvider {
},
required: ['text', 'delay']
}
};
};*/
}
async chat(message, retryCount = 0) {
@@ -65,6 +69,7 @@ class OllamaProvider {
model: this.model,
messages: messages,
stream: false,
think: false,
format: this.__jsonFormat(),
options: this.__settings()
};
@@ -74,7 +79,7 @@ class OllamaProvider {
`${this.baseUrl}/api/chat`,
requestBody,
{
timeout: this.config.timeout || 30000,
// timeout: this.config.timeout || 30000,
headers: {
'Content-Type': 'application/json'
}
@@ -83,6 +88,7 @@ class OllamaProvider {
// Log raw response for debugging
const rawContent = response.data.message.content;
console.log('Ollama response', rawContent)
// console.log('Ollama raw response:', JSON.stringify(rawContent));
// console.log('Ollama raw response length:', rawContent?.length);