forked from open-webui/open-webui
feat: editable prompt suggestions integration
This commit is contained in:
parent
4e1b52e91b
commit
c4a039326f
6 changed files with 172 additions and 52 deletions
|
@ -29,3 +29,33 @@ export const setDefaultModels = async (token: string, models: string) => {
|
|||
|
||||
return res;
|
||||
};
|
||||
|
||||
export const setDefaultPromptSuggestions = async (token: string, promptSuggestions: string) => {
|
||||
let error = null;
|
||||
|
||||
const res = await fetch(`${WEBUI_API_BASE_URL}/configs/default/suggestions`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${token}`
|
||||
},
|
||||
body: JSON.stringify({
|
||||
suggestions: promptSuggestions
|
||||
})
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (!res.ok) throw await res.json();
|
||||
return res.json();
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
error = err.detail;
|
||||
return null;
|
||||
});
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue