feat: enable backend ollama url update

This commit is contained in:
Timothy J. Baek 2024-01-04 13:06:31 -08:00
parent bdb3f50771
commit 30aff2db53
13 changed files with 554 additions and 409 deletions

View file

@ -6,7 +6,6 @@
import { onMount } from 'svelte';
import { modelfiles, settings, user } from '$lib/stores';
import { OLLAMA_API_BASE_URL } from '$lib/constants';
import { createModel, deleteModel } from '$lib/apis/ollama';
import {
createNewModelfile,
@ -20,11 +19,7 @@
const deleteModelHandler = async (tagName) => {
let success = null;
success = await deleteModel(
$settings?.API_BASE_URL ?? OLLAMA_API_BASE_URL,
localStorage.token,
tagName
);
success = await deleteModel(localStorage.token, tagName);
if (success) {
toast.success(`Deleted ${tagName}`);

View file

@ -2,7 +2,6 @@
import { v4 as uuidv4 } from 'uuid';
import { toast } from 'svelte-french-toast';
import { goto } from '$app/navigation';
import { OLLAMA_API_BASE_URL } from '$lib/constants';
import { settings, user, config, modelfiles, models } from '$lib/stores';
import Advanced from '$lib/components/chat/Settings/Advanced.svelte';
@ -132,12 +131,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
Object.keys(categories).filter((category) => categories[category]).length > 0 &&
!$models.includes(tagName)
) {
const res = await createModel(
$settings?.API_BASE_URL ?? OLLAMA_API_BASE_URL,
localStorage.token,
tagName,
content
);
const res = await createModel(localStorage.token, tagName, content);
if (res) {
const reader = res.body

View file

@ -7,8 +7,6 @@
import { page } from '$app/stores';
import { settings, user, config, modelfiles } from '$lib/stores';
import { OLLAMA_API_BASE_URL } from '$lib/constants';
import { splitStream } from '$lib/utils';
import { createModel } from '$lib/apis/ollama';
@ -104,12 +102,7 @@
content !== '' &&
Object.keys(categories).filter((category) => categories[category]).length > 0
) {
const res = await createModel(
$settings?.API_BASE_URL ?? OLLAMA_API_BASE_URL,
localStorage.token,
tagName,
content
);
const res = await createModel(localStorage.token, tagName, content);
if (res) {
const reader = res.body