enh: prompt tags
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user