Get settings from backend, added web search functionality

This commit is contained in:
Rafi
2023-03-23 11:45:56 +08:00
parent e90dc0c12b
commit 27c5e2a3ac
7 changed files with 61 additions and 28 deletions

View File

@@ -50,4 +50,23 @@ export const genTitle = async (conversationId) => {
return data.value.title
}
return null
}
const transformData = (list) => {
const result = {};
for (let i = 0; i < list.length; i++) {
const item = list[i];
result[item.name] = item.value;
}
return result;
}
export const loadSettings = async () => {
const settings = useSettings()
const { data, error } = await useAuthFetch('/api/chat/settings/', {
method: 'GET'
})
if (!error.value) {
settings.value = transformData(data.value)
}
}