fix: type

This commit is contained in:
Neko Ayaka
2025-07-21 15:03:40 +08:00
parent f471bec2d4
commit 79f8a58fbf
11 changed files with 36 additions and 19 deletions
@@ -117,15 +117,14 @@ const cssVars = computed(() => {
<span
class="background-label mt-2"
leading="[1]"
absolute inline-block font-semibold font-quicksand
font-quicksand absolute inline-block font-semibold
:style="{ writingMode: 'vertical-rl' }"
>
{{ backgroundLabel }}
</span>
</div>
<!-- Title section -->
<div relative z-3 pb-4 pl-4 pt-2 font-jura>
<div font-jura relative z-3 pb-4 pl-4 pt-2>
<div relative z-4 class="subtitle-text">
<!-- Subtitle section -->
<div text-base font-semibold>
@@ -135,7 +134,7 @@ const cssVars = computed(() => {
<div
class="title-text"
text-6xl font-bold font-jura font-italic text-stroke-1
font-jura text-6xl font-bold font-italic text-stroke-1
:style="{ paintOrder: 'stroke fill' }"
leading="[0.75]"
>
@@ -162,7 +161,7 @@ const cssVars = computed(() => {
<!-- Divider section -->
<div mx-5 h-0.5 rounded-full class="divider" />
<!-- Info section -->
<div class="description" max-h="[4.5rem]" mx-5 mb-4 mt-2 h-full font-quicksand>
<div class="description" max-h="[4.5rem]" font-quicksand mx-5 mb-4 mt-2 h-full>
<div h-full text-base>
{{ description }}
</div>
+22 -4
View File
@@ -95,7 +95,9 @@ export interface ProviderMetadata {
*/
iconImage?: string
defaultOptions?: () => Record<string, unknown>
createProvider: (config: Record<string, unknown>) => Promise<
createProvider: (
config: Record<string, unknown>
) =>
| ChatProvider
| ChatProviderWithExtraOptions
| EmbedProvider
@@ -104,7 +106,14 @@ export interface ProviderMetadata {
| SpeechProviderWithExtraOptions
| TranscriptionProvider
| TranscriptionProviderWithExtraOptions
>
| Promise<ChatProvider>
| Promise<ChatProviderWithExtraOptions>
| Promise<EmbedProvider>
| Promise<EmbedProviderWithExtraOptions>
| Promise<SpeechProvider>
| Promise<SpeechProviderWithExtraOptions>
| Promise<TranscriptionProvider>
| Promise<TranscriptionProviderWithExtraOptions>
capabilities: {
listModels?: (config: Record<string, unknown>) => Promise<ModelInfo[]>
listVoices?: (config: Record<string, unknown>) => Promise<VoiceInfo[]>
@@ -1689,7 +1698,16 @@ export const useProvidersStore = defineStore('providers', () => {
})
// Function to get provider object by provider id
async function getProviderInstance(providerId: string) {
async function getProviderInstance<R extends
| ChatProvider
| ChatProviderWithExtraOptions
| EmbedProvider
| EmbedProviderWithExtraOptions
| SpeechProvider
| SpeechProviderWithExtraOptions
| TranscriptionProvider
| TranscriptionProviderWithExtraOptions,
>(providerId: string): Promise<R> {
const config = providerCredentials.value[providerId]
if (!config)
throw new Error(`Provider credentials for ${providerId} not found`)
@@ -1699,7 +1717,7 @@ export const useProvidersStore = defineStore('providers', () => {
throw new Error(`Provider metadata for ${providerId} not found`)
try {
return await metadata.createProvider(config)
return await metadata.createProvider(config) as R
}
catch (error) {
console.error(`Error creating provider instance for ${providerId}:`, error)