import { Ollama } from "ollama/browser";
// const ollama = new Ollama({ host: 'http://192.168.9.61:11434' })
const ollama = new Ollama({ host: 'http://192.168.0.25/answers' })
export function chatWithHistory(model, userMsg, history, systemMsg) {
  return ollama.chat({
    model,
    messages: [
      { role: "system", content: systemMsg },
      ...history,
      { role: "user", content: userMsg },
    ],
    stream: true,
  });
}

export function chat(systemMsg, userMsg) {
  return ollama.chat({
    model: 'deepseek-r1:70b',
    messages: [
      { role: "system", content: systemMsg },
      { role: "user", content: userMsg },
    ],
    stream: true,
  });
}

export function listModels() {
  return ollama.list();
}

export function abort() {
  ollama.abort();
}