This commit is contained in:
Timothy Jaeryang Baek
2026-01-24 02:57:08 +04:00
parent 6ab7d54982
commit 44da9c6523
4 changed files with 75 additions and 7 deletions
+32
View File
@@ -171,6 +171,38 @@ export const getPromptByCommand = async (token: string, command: string) => {
return res;
};
export const getPromptById = async (token: string, promptId: string) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/prompts/id/${promptId}`, {
method: 'GET',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
authorization: `Bearer ${token}`
}
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.json();
})
.then((json) => {
return json;
})
.catch((err) => {
error = err.detail;
console.error(err);
return null;
});
if (error) {
throw error;
}
return res;
};
export const updatePromptByCommand = async (token: string, prompt: PromptItem) => {
let error = null;
+1 -1
View File
@@ -338,7 +338,7 @@
{#each filteredItems as prompt}
<a
class=" flex space-x-4 cursor-pointer text-left w-full px-3 py-2.5 dark:hover:bg-gray-850/50 hover:bg-gray-50 transition rounded-2xl"
href={`/workspace/prompts/edit?command=${encodeURIComponent(prompt.command)}`}
href={`/workspace/prompts/${prompt.id}`}
>
<div class=" flex flex-col flex-1 space-x-4 cursor-pointer w-full pl-1">
<div class="flex items-center justify-between w-full">