enh: prompt tags

This commit is contained in:
Timothy Jaeryang Baek
2026-01-26 16:11:10 +04:00
parent f199c486a2
commit 4c8d4e6dbd
8 changed files with 173 additions and 16 deletions
+31 -2
View File
@@ -108,6 +108,34 @@ export const getPrompts = async (token: string = '') => {
return res;
};
export const getPromptTags = async (token: string = '') => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/prompts/tags`, {
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();
})
.catch((err) => {
error = err.detail;
console.error(err);
return null;
});
if (error) {
throw error;
}
return res;
};
export const getPromptList = async (token: string = '') => {
let error = null;
@@ -242,7 +270,8 @@ export const updatePromptMetadata = async (
token: string,
promptId: string,
name: string,
command: string
command: string,
tags: string[] = []
) => {
let error = null;
@@ -253,7 +282,7 @@ export const updatePromptMetadata = async (
'Content-Type': 'application/json',
authorization: `Bearer ${token}`
},
body: JSON.stringify({ name, command })
body: JSON.stringify({ name, command, tags })
})
.then(async (res) => {
if (!res.ok) throw await res.json();