mirror of
https://github.com/JorySeverijnse/ui-fixer-supreme.git
synced 2025-12-06 21:36:57 +00:00
Compare commits
7 Commits
16fdfa48b7
...
5ed5b2d49b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ed5b2d49b | ||
|
|
69368e1461 | ||
|
|
0757265b0d | ||
|
|
ad7e9c4c86 | ||
|
|
7218d57061 | ||
|
|
3e56bb56cc | ||
|
|
eff48e239f |
@ -11,6 +11,12 @@ export interface AIProviderConfig {
|
|||||||
allowsCustomKey?: boolean;
|
allowsCustomKey?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getGptOssApiKey = (): string | undefined => {
|
||||||
|
return import.meta.env?.VITE_GPT_OSS_API_KEY ||
|
||||||
|
process.env.VITE_GPT_OSS_API_KEY ||
|
||||||
|
process.env.NEXT_PUBLIC_GPT_OSS_API_KEY;
|
||||||
|
};
|
||||||
|
|
||||||
export const AI_PROVIDERS: AIProviderConfig[] = [
|
export const AI_PROVIDERS: AIProviderConfig[] = [
|
||||||
{
|
{
|
||||||
id: 'pollinations',
|
id: 'pollinations',
|
||||||
@ -23,10 +29,12 @@ export const AI_PROVIDERS: AIProviderConfig[] = [
|
|||||||
{
|
{
|
||||||
id: 'gpt-oss',
|
id: 'gpt-oss',
|
||||||
name: 'GPT-OSS-20B',
|
name: 'GPT-OSS-20B',
|
||||||
description: 'Alternative model (IP-locked)',
|
description: 'Alternative model (requires API key)',
|
||||||
endpoint: 'https://api.pawan.krd/gpt-oss-20b/v1/chat/completions',
|
endpoint: 'https://api.pawan.krd/gpt-oss-20b/v1/chat/completions',
|
||||||
requiresAuth: true,
|
requiresAuth: true,
|
||||||
apiKey: 'pk-AvSqFEAjTobfSGEGTnqKVuSwcfcDDMeEZSkeFqnlrGFJNVAC',
|
get apiKey() {
|
||||||
|
return getGptOssApiKey();
|
||||||
|
},
|
||||||
model: 'gpt-oss-20b',
|
model: 'gpt-oss-20b',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -41,7 +49,26 @@ export const AI_PROVIDERS: AIProviderConfig[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const getProvider = (id: AIProvider): AIProviderConfig => {
|
export const getProvider = (id: AIProvider): AIProviderConfig => {
|
||||||
return AI_PROVIDERS.find(p => p.id === id) || AI_PROVIDERS[0];
|
const provider = AI_PROVIDERS.find(p => p.id === id) || AI_PROVIDERS[0];
|
||||||
|
|
||||||
|
if (id === 'custom') {
|
||||||
|
const stored = localStorage.getItem(CUSTOM_API_STORAGE_KEY);
|
||||||
|
if (stored) {
|
||||||
|
try {
|
||||||
|
const customConfig = JSON.parse(stored);
|
||||||
|
return {
|
||||||
|
...provider,
|
||||||
|
endpoint: customConfig.endpoint || '',
|
||||||
|
apiKey: customConfig.apiKey || undefined,
|
||||||
|
model: customConfig.model || '',
|
||||||
|
};
|
||||||
|
} catch {
|
||||||
|
return provider;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return provider;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CUSTOM_API_STORAGE_KEY = 'ai-chat-custom-api';
|
export const CUSTOM_API_STORAGE_KEY = 'ai-chat-custom-api';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user