chore: format

This commit is contained in:
Timothy Jaeryang Baek committed 2026-02-11 16:24:11 -06:00
1 parent 89fddcc741
commit f376d4f378
202 files changed
+8328 -2046

No files matched your search

+256 -254
View File
@@ -1,317 +1,319 @@
import { WEBUI_API_BASE_URL } from '$lib/constants';
export const getModelAnalytics = async (
token: string = '',
startDate: number | null = null,
endDate: number | null = null,
groupId: string | null = null
token: string = '',
startDate: number | null = null,
endDate: number | null = null,
groupId: string | null = null
) => {
let error = null;
let error = null;
const searchParams = new URLSearchParams();
if (startDate) searchParams.append('start_date', startDate.toString());
if (endDate) searchParams.append('end_date', endDate.toString());
if (groupId) searchParams.append('group_id', groupId);
const searchParams = new URLSearchParams();
if (startDate) searchParams.append('start_date', startDate.toString());
if (endDate) searchParams.append('end_date', endDate.toString());
if (groupId) searchParams.append('group_id', groupId);
const res = await fetch(`${WEBUI_API_BASE_URL}/analytics/models?${searchParams.toString()}`, {
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;
});
const res = await fetch(`${WEBUI_API_BASE_URL}/analytics/models?${searchParams.toString()}`, {
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;
}
if (error) {
throw error;
}
return res;
return res;
};
export const getUserAnalytics = async (
token: string = '',
startDate: number | null = null,
endDate: number | null = null,
limit: number = 50,
groupId: string | null = null
token: string = '',
startDate: number | null = null,
endDate: number | null = null,
limit: number = 50,
groupId: string | null = null
) => {
let error = null;
let error = null;
const searchParams = new URLSearchParams();
if (startDate) searchParams.append('start_date', startDate.toString());
if (endDate) searchParams.append('end_date', endDate.toString());
if (limit) searchParams.append('limit', limit.toString());
if (groupId) searchParams.append('group_id', groupId);
const searchParams = new URLSearchParams();
if (startDate) searchParams.append('start_date', startDate.toString());
if (endDate) searchParams.append('end_date', endDate.toString());
if (limit) searchParams.append('limit', limit.toString());
if (groupId) searchParams.append('group_id', groupId);
const res = await fetch(`${WEBUI_API_BASE_URL}/analytics/users?${searchParams.toString()}`, {
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;
});
const res = await fetch(`${WEBUI_API_BASE_URL}/analytics/users?${searchParams.toString()}`, {
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;
}
if (error) {
throw error;
}
return res;
return res;
};
export const getMessages = async (
token: string = '',
modelId: string | null = null,
userId: string | null = null,
chatId: string | null = null,
startDate: number | null = null,
endDate: number | null = null,
skip: number = 0,
limit: number = 50
token: string = '',
modelId: string | null = null,
userId: string | null = null,
chatId: string | null = null,
startDate: number | null = null,
endDate: number | null = null,
skip: number = 0,
limit: number = 50
) => {
let error = null;
let error = null;
const searchParams = new URLSearchParams();
if (modelId) searchParams.append('model_id', modelId);
if (userId) searchParams.append('user_id', userId);
if (chatId) searchParams.append('chat_id', chatId);
if (startDate) searchParams.append('start_date', startDate.toString());
if (endDate) searchParams.append('end_date', endDate.toString());
if (skip) searchParams.append('skip', skip.toString());
if (limit) searchParams.append('limit', limit.toString());
const searchParams = new URLSearchParams();
if (modelId) searchParams.append('model_id', modelId);
if (userId) searchParams.append('user_id', userId);
if (chatId) searchParams.append('chat_id', chatId);
if (startDate) searchParams.append('start_date', startDate.toString());
if (endDate) searchParams.append('end_date', endDate.toString());
if (skip) searchParams.append('skip', skip.toString());
if (limit) searchParams.append('limit', limit.toString());
const res = await fetch(`${WEBUI_API_BASE_URL}/analytics/messages?${searchParams.toString()}`, {
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;
});
const res = await fetch(`${WEBUI_API_BASE_URL}/analytics/messages?${searchParams.toString()}`, {
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;
}
if (error) {
throw error;
}
return res;
return res;
};
export const getSummary = async (
token: string = '',
startDate: number | null = null,
endDate: number | null = null,
groupId: string | null = null
token: string = '',
startDate: number | null = null,
endDate: number | null = null,
groupId: string | null = null
) => {
let error = null;
let error = null;
const searchParams = new URLSearchParams();
if (startDate) searchParams.append('start_date', startDate.toString());
if (endDate) searchParams.append('end_date', endDate.toString());
if (groupId) searchParams.append('group_id', groupId);
const searchParams = new URLSearchParams();
if (startDate) searchParams.append('start_date', startDate.toString());
if (endDate) searchParams.append('end_date', endDate.toString());
if (groupId) searchParams.append('group_id', groupId);
const res = await fetch(`${WEBUI_API_BASE_URL}/analytics/summary?${searchParams.toString()}`, {
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;
});
const res = await fetch(`${WEBUI_API_BASE_URL}/analytics/summary?${searchParams.toString()}`, {
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;
}
if (error) {
throw error;
}
return res;
return res;
};
export const getDailyStats = async (
token: string = '',
startDate: number | null = null,
endDate: number | null = null,
granularity: 'hourly' | 'daily' = 'daily',
groupId: string | null = null
token: string = '',
startDate: number | null = null,
endDate: number | null = null,
granularity: 'hourly' | 'daily' = 'daily',
groupId: string | null = null
) => {
let error = null;
let error = null;
const searchParams = new URLSearchParams();
if (startDate) searchParams.append('start_date', startDate.toString());
if (endDate) searchParams.append('end_date', endDate.toString());
searchParams.append('granularity', granularity);
if (groupId) searchParams.append('group_id', groupId);
const searchParams = new URLSearchParams();
if (startDate) searchParams.append('start_date', startDate.toString());
if (endDate) searchParams.append('end_date', endDate.toString());
searchParams.append('granularity', granularity);
if (groupId) searchParams.append('group_id', groupId);
const res = await fetch(`${WEBUI_API_BASE_URL}/analytics/daily?${searchParams.toString()}`, {
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;
});
const res = await fetch(`${WEBUI_API_BASE_URL}/analytics/daily?${searchParams.toString()}`, {
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;
}
if (error) {
throw error;
}
return res;
return res;
};
export const getTokenUsage = async (
token: string = '',
startDate: number | null = null,
endDate: number | null = null,
groupId: string | null = null
token: string = '',
startDate: number | null = null,
endDate: number | null = null,
groupId: string | null = null
) => {
let error = null;
let error = null;
const searchParams = new URLSearchParams();
if (startDate) searchParams.append('start_date', startDate.toString());
if (endDate) searchParams.append('end_date', endDate.toString());
if (groupId) searchParams.append('group_id', groupId);
const searchParams = new URLSearchParams();
if (startDate) searchParams.append('start_date', startDate.toString());
if (endDate) searchParams.append('end_date', endDate.toString());
if (groupId) searchParams.append('group_id', groupId);
const res = await fetch(`${WEBUI_API_BASE_URL}/analytics/tokens?${searchParams.toString()}`, {
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;
});
const res = await fetch(`${WEBUI_API_BASE_URL}/analytics/tokens?${searchParams.toString()}`, {
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;
}
if (error) {
throw error;
}
return res;
return res;
};
export const getModelChats = async (
token: string = '',
modelId: string,
startDate: number | null = null,
endDate: number | null = null,
skip: number = 0,
limit: number = 50
token: string = '',
modelId: string,
startDate: number | null = null,
endDate: number | null = null,
skip: number = 0,
limit: number = 50
) => {
let error = null;
let error = null;
const searchParams = new URLSearchParams();
if (startDate) searchParams.append('start_date', startDate.toString());
if (endDate) searchParams.append('end_date', endDate.toString());
if (skip) searchParams.append('skip', skip.toString());
if (limit) searchParams.append('limit', limit.toString());
const searchParams = new URLSearchParams();
if (startDate) searchParams.append('start_date', startDate.toString());
if (endDate) searchParams.append('end_date', endDate.toString());
if (skip) searchParams.append('skip', skip.toString());
if (limit) searchParams.append('limit', limit.toString());
const res = await fetch(`${WEBUI_API_BASE_URL}/analytics/models/${encodeURIComponent(modelId)}/chats?${searchParams.toString()}`, {
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;
});
const res = await fetch(
`${WEBUI_API_BASE_URL}/analytics/models/${encodeURIComponent(modelId)}/chats?${searchParams.toString()}`,
{
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;
}
if (error) {
throw error;
}
return res;
return res;
};
export const getModelOverview = async (
token: string = '',
modelId: string,
days: number = 30
) => {
let error = null;
export const getModelOverview = async (token: string = '', modelId: string, days: number = 30) => {
let error = null;
const searchParams = new URLSearchParams();
searchParams.append('days', days.toString());
const searchParams = new URLSearchParams();
searchParams.append('days', days.toString());
const res = await fetch(`${WEBUI_API_BASE_URL}/analytics/models/${encodeURIComponent(modelId)}/overview?${searchParams.toString()}`, {
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;
});
const res = await fetch(
`${WEBUI_API_BASE_URL}/analytics/models/${encodeURIComponent(modelId)}/overview?${searchParams.toString()}`,
{
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;
}
if (error) {
throw error;
}
return res;
return res;
};
+1 -5
View File
@@ -255,11 +255,7 @@ export const getArchivedChatList = async (
}));
};
export const getSharedChatList = async (
token: string = '',
page: number = 1,
filter?: object
) => {
export const getSharedChatList = async (token: string = '', page: number = 1, filter?: object) => {
let error = null;
const searchParams = new URLSearchParams();
+1 -1
View File
@@ -1675,7 +1675,7 @@ export interface ModelMeta {
profile_image_url?: string;
}
export interface ModelParams { }
export interface ModelParams {}
export type GlobalModelConfig = ModelConfig[];
+1 -5
View File
@@ -281,11 +281,7 @@ export const updateModelById = async (token: string, id: string, model: object)
return res;
};
export const updateModelAccessGrants = async (
token: string,
id: string,
accessGrants: any[]
) => {
export const updateModelAccessGrants = async (token: string, id: string, accessGrants: any[]) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/models/model/access/update`, {
+1 -5
View File
@@ -253,11 +253,7 @@ export const updateNoteById = async (token: string, id: string, note: NoteItem)
return res;
};
export const updateNoteAccessGrants = async (
token: string,
id: string,
accessGrants: any[]
) => {
export const updateNoteAccessGrants = async (token: string, id: string, accessGrants: any[]) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/notes/${id}/access/update`, {
+26 -36
View File
@@ -1,16 +1,16 @@
import { WEBUI_API_BASE_URL } from '$lib/constants';
type PromptItem = {
id?: string; // Prompt ID
id?: string; // Prompt ID
command: string;
name: string; // Changed from title
name: string; // Changed from title
content: string;
data?: object | null;
meta?: object | null;
access_grants?: object[];
version_id?: string | null; // Active version
commit_message?: string | null; // For history tracking
is_production?: boolean; // Whether to set new version as production
version_id?: string | null; // Active version
commit_message?: string | null; // For history tracking
is_production?: boolean; // Whether to set new version as production
};
type PromptHistoryItem = {
@@ -196,7 +196,6 @@ export const getPromptItems = async (
};
export const getPromptList = async (token: string = '') => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/prompts/list`, {
@@ -472,17 +471,14 @@ export const getPromptHistory = async (
): Promise<PromptHistoryItem[]> => {
let error = null;
const res = await fetch(
`${WEBUI_API_BASE_URL}/prompts/id/${promptId}/history?page=${page}`,
{
method: 'GET',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
authorization: `Bearer ${token}`
}
const res = await fetch(`${WEBUI_API_BASE_URL}/prompts/id/${promptId}/history?page=${page}`, {
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();
@@ -507,17 +503,14 @@ export const deletePromptHistoryVersion = async (
): Promise<boolean> => {
let error = null;
const res = await fetch(
`${WEBUI_API_BASE_URL}/prompts/id/${promptId}/history/${historyId}`,
{
method: 'DELETE',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
authorization: `Bearer ${token}`
}
const res = await fetch(`${WEBUI_API_BASE_URL}/prompts/id/${promptId}/history/${historyId}`, {
method: 'DELETE',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
authorization: `Bearer ${token}`
}
)
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.json();
@@ -542,17 +535,14 @@ export const getPromptHistoryEntry = async (
): Promise<PromptHistoryItem> => {
let error = null;
const res = await fetch(
`${WEBUI_API_BASE_URL}/prompts/id/${promptId}/history/${historyId}`,
{
method: 'GET',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
authorization: `Bearer ${token}`
}
const res = await fetch(`${WEBUI_API_BASE_URL}/prompts/id/${promptId}/history/${historyId}`, {
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();
+1 -5
View File
@@ -227,11 +227,7 @@ export const updateSkillById = async (token: string, id: string, skill: object)
return res;
};
export const updateSkillAccessGrants = async (
token: string,
id: string,
accessGrants: any[]
) => {
export const updateSkillAccessGrants = async (token: string, id: string, accessGrants: any[]) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/skills/id/${id}/access/update`, {
+10 -10
View File
@@ -1,14 +1,14 @@
import { WEBUI_API_BASE_URL } from '$lib/constants';
export const checkActiveChats = async (token: string, chatIds: string[]) => {
const res = await fetch(`${WEBUI_API_BASE_URL}/tasks/active/chats`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`
},
body: JSON.stringify({ chat_ids: chatIds })
});
if (!res.ok) throw await res.json();
return res.json();
const res = await fetch(`${WEBUI_API_BASE_URL}/tasks/active/chats`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`
},
body: JSON.stringify({ chat_ids: chatIds })
});
if (!res.ok) throw await res.json();
return res.json();
};
+1 -5
View File
@@ -225,11 +225,7 @@ export const updateToolById = async (token: string, id: string, tool: object) =>
return res;
};
export const updateToolAccessGrants = async (
token: string,
id: string,
accessGrants: any[]
) => {
export const updateToolAccessGrants = async (token: string, id: string, accessGrants: any[]) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/tools/id/${id}/access/update`, {
-1
View File
@@ -300,7 +300,6 @@ export const updateUserSettings = async (token: string, settings: object) => {
return res;
};
export const getUserInfoById = async (token: string, userId: string) => {
let error = null;