🚸 parse URL for Ollama endpoint

This commit is contained in:
Nate Sesti 2024-03-10 14:24:00 -07:00
parent 45603db3d2
commit 52a142da64
2 changed files with 5 additions and 5 deletions

View file

@ -21,7 +21,7 @@ class Ollama extends BaseLLM {
if (options.model === "AUTODETECT") {
return;
}
this.fetch(`${this.apiBase}/api/show`, {
this.fetch(new URL("api/show", this.apiBase), {
method: "POST",
headers: {},
body: JSON.stringify({ name: this._getModel() }),
@ -141,7 +141,7 @@ class Ollama extends BaseLLM {
prompt: string,
options: CompletionOptions,
): AsyncGenerator<string> {
const response = await this.fetch(`${this.apiBase}/api/generate`, {
const response = await this.fetch(new URL("api/generate", this.apiBase), {
method: "POST",
headers: {
"Content-Type": "application/json",
@ -180,7 +180,7 @@ class Ollama extends BaseLLM {
messages: ChatMessage[],
options: CompletionOptions,
): AsyncGenerator<ChatMessage> {
const response = await this.fetch(`${this.apiBase}/api/chat`, {
const response = await this.fetch(new URL("api/chat", this.apiBase), {
method: "POST",
headers: {
"Content-Type": "application/json",
@ -218,7 +218,7 @@ class Ollama extends BaseLLM {
}
async listModels(): Promise<string[]> {
const response = await this.fetch(`${this.apiBase}/api/tags`, {
const response = await this.fetch(new URL("api/tags", this.apiBase), {
method: "GET",
});
const data = await response.json();

View file

@ -1,7 +1,7 @@
{
"name": "continue",
"icon": "media/icon.png",
"version": "0.9.82",
"version": "0.9.83",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"