This commit is contained in:
2026-02-22 21:24:08 +00:00
parent 7fe7260f51
commit 99a27e5b13
3 changed files with 52 additions and 4 deletions
+10 -1
View File
@@ -12,11 +12,16 @@ export function modelKey(m: ModelOption): string {
// Store provider names globally for display
let globalProviderNames: Record<string, string> = {};
let globalHostHome = '';
export function getProviderDisplayName(providerId: string): string {
return globalProviderNames[providerId] || providerId;
}
export function getHostHome(): string {
return globalHostHome;
}
export function usePiModels() {
const client = useClient();
const { isAuthenticated } = useAuth();
@@ -25,7 +30,7 @@ export function usePiModels() {
queryKey: ['PI_MODELS'],
enabled: isAuthenticated,
queryFn: async () => {
const data = await client.get<{ models: ModelOption[]; providerNames?: Record<string, string> }>('/pi/models');
const data = await client.get<{ models: ModelOption[]; providerNames?: Record<string, string>; hostHome?: string }>('/pi/models');
console.log('[usePiModels] Fetched models:', {
modelCount: data.models.length,
@@ -38,6 +43,10 @@ export function usePiModels() {
globalProviderNames = data.providerNames;
console.log('[usePiModels] Stored provider names:', globalProviderNames);
}
if (data.hostHome) {
globalHostHome = data.hostHome;
}
return data.models;
},