Skip to content
Snippets Groups Projects
Commit 80527d9d authored by HARTZ HENRI's avatar HARTZ HENRI
Browse files

feat: add ollama url to .env

parent 6bf59eb9
Branches
2 merge requests!95V4.0,!81Feature/71 generatetrueanswer
Pipeline #324324 passed with stages
in 1 minute and 39 seconds
......@@ -8,6 +8,7 @@ PORT=
WS_PORT=
SSL_CERTIFICAT=
SSL_PRIVKEY=
OLLAMA_URL=
DATABASE_URL="mysql://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_DATABASE}"
......
import { Injectable } from '@nestjs/common';
import ollama, { Ollama } from 'ollama';
@Injectable()
export class OllamaService {
private readonly url = 'http://klebert-host.com:11434/';
async generateTrueAnswer(question: string) {
try {
......@@ -22,13 +20,13 @@ export class OllamaService {
}
}
const response = await fetch(this.url+ 'api/generate', {
const response = await fetch(process.env.OLLAMA_URL + 'api/generate', {
method: 'POST',
body: JSON.stringify(body)
});
const data = await response.json();
return data.response;
} catch (error) {
console.error('Error in generateTrueAnswer:', error.message, error.stack);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment