diff --git a/backend/apps/ollama/main.py b/backend/apps/ollama/main.py
index 5568f359d..7288f3467 100644
--- a/backend/apps/ollama/main.py
+++ b/backend/apps/ollama/main.py
@@ -920,8 +920,14 @@ async def generate_chat_completion(
)
payload["options"]["seed"] = model_info.params.get("seed", None)
- # TODO: add "stop" back in
- # payload["stop"] = model_info.params.get("stop", None)
+ payload["options"]["stop"] = (
+ [
+ bytes(stop, "utf-8").decode("unicode_escape")
+ for stop in model_info.params["stop"]
+ ]
+ if model_info.params.get("stop", None)
+ else None
+ )
payload["options"]["tfs_z"] = model_info.params.get("tfs_z", None)
@@ -1076,8 +1082,14 @@ async def generate_openai_chat_completion(
"frequency_penalty", None
)
payload["seed"] = model_info.params.get("seed", None)
- # TODO: add "stop" back in
- # payload["stop"] = model_info.params.get("stop", None)
+ payload["stop"] = (
+ [
+ bytes(stop, "utf-8").decode("unicode_escape")
+ for stop in model_info.params["stop"]
+ ]
+ if model_info.params.get("stop", None)
+ else None
+ )
if model_info.params.get("system", None):
# Check if the payload already has a system message
diff --git a/backend/apps/openai/main.py b/backend/apps/openai/main.py
index df1b28638..ded7e6626 100644
--- a/backend/apps/openai/main.py
+++ b/backend/apps/openai/main.py
@@ -343,8 +343,14 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)):
"frequency_penalty", None
)
payload["seed"] = model_info.params.get("seed", None)
- # TODO: add "stop" back in
- # payload["stop"] = model_info.params.get("stop", None)
+ payload["stop"] = (
+ [
+ bytes(stop, "utf-8").decode("unicode_escape")
+ for stop in model_info.params["stop"]
+ ]
+ if model_info.params.get("stop", None)
+ else None
+ )
if model_info.params.get("system", None):
# Check if the payload already has a system message
diff --git a/src/lib/components/chat/Settings/Advanced.svelte b/src/lib/components/chat/Settings/Advanced.svelte
deleted file mode 100644
index 94c081d52..000000000
--- a/src/lib/components/chat/Settings/Advanced.svelte
+++ /dev/null
@@ -1,156 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/src/lib/components/chat/Settings/Advanced/AdvancedParams.svelte b/src/lib/components/chat/Settings/Advanced/AdvancedParams.svelte
index 27c146f5b..93c482711 100644
--- a/src/lib/components/chat/Settings/Advanced/AdvancedParams.svelte
+++ b/src/lib/components/chat/Settings/Advanced/AdvancedParams.svelte
@@ -8,7 +8,7 @@
export let params = {
// Advanced
seed: 0,
- stop: '',
+ stop: null,
temperature: '',
frequency_penalty: '',
repeat_last_n: '',
diff --git a/src/lib/components/chat/Settings/General.svelte b/src/lib/components/chat/Settings/General.svelte
index 511f09acc..ae08e5234 100644
--- a/src/lib/components/chat/Settings/General.svelte
+++ b/src/lib/components/chat/Settings/General.svelte
@@ -52,7 +52,7 @@
mirostat_tau: '',
top_k: '',
top_p: '',
- stop: '',
+ stop: null,
tfs_z: '',
num_ctx: '',
max_tokens: ''
@@ -87,7 +87,7 @@
params.top_p = settings.top_p ?? '';
params.num_ctx = settings.num_ctx ?? '';
params = { ...params, ...settings.params };
- params.stop = (settings?.params?.stop ?? []).join(',');
+ params.stop = settings?.params?.stop ? (settings?.params?.stop ?? []).join(',') : null;
});
const applyTheme = (_theme: string) => {
@@ -302,7 +302,7 @@
system: system !== '' ? system : undefined,
params: {
seed: (params.seed !== 0 ? params.seed : undefined) ?? undefined,
- stop: params.stop !== '' ? params.stop.split(',').filter((e) => e) : undefined,
+ stop: params.stop !== null ? params.stop.split(',').filter((e) => e) : undefined,
temperature: params.temperature !== '' ? params.temperature : undefined,
frequency_penalty:
params.frequency_penalty !== '' ? params.frequency_penalty : undefined,
diff --git a/src/routes/(app)/workspace/models/create/+page.svelte b/src/routes/(app)/workspace/models/create/+page.svelte
index 827455b17..bc71cad7b 100644
--- a/src/routes/(app)/workspace/models/create/+page.svelte
+++ b/src/routes/(app)/workspace/models/create/+page.svelte
@@ -62,6 +62,7 @@
info.id = id;
info.name = name;
info.meta.capabilities = capabilities;
+ info.params.stop = params.stop !== null ? params.stop.split(',').filter((s) => s.trim()) : null;
if ($models.find((m) => m.id === info.id)) {
toast.error(
@@ -103,6 +104,8 @@
id = model.id;
params = { ...params, ...model?.info?.params };
+ params.stop = params?.stop ? (params?.stop ?? []).join(',') : null;
+
capabilities = { ...capabilities, ...(model?.info?.meta?.capabilities ?? {}) };
info = {
diff --git a/src/routes/(app)/workspace/models/edit/+page.svelte b/src/routes/(app)/workspace/models/edit/+page.svelte
index 63ca1fa12..3323b96de 100644
--- a/src/routes/(app)/workspace/models/edit/+page.svelte
+++ b/src/routes/(app)/workspace/models/edit/+page.svelte
@@ -63,6 +63,7 @@
info.id = id;
info.name = name;
info.meta.capabilities = capabilities;
+ info.params.stop = params.stop !== null ? params.stop.split(',').filter((s) => s.trim()) : null;
const res = await updateModelById(localStorage.token, info.id, info);
@@ -104,6 +105,7 @@
}
params = { ...params, ...model?.info?.params };
+ params.stop = params?.stop ? (params?.stop ?? []).join(',') : null;
if (model?.info?.meta?.capabilities) {
capabilities = { ...capabilities, ...model?.info?.meta?.capabilities };
diff --git a/src/routes/modelfiles/create/+page.svelte b/src/routes/modelfiles/create/+page.svelte
deleted file mode 100644
index 9d0d60d0b..000000000
--- a/src/routes/modelfiles/create/+page.svelte
+++ /dev/null
@@ -1,27 +0,0 @@
-