Skip to content

Commit 60046f8

Browse files
build provider model loader UI
1 parent c42716d commit 60046f8

13 files changed

Lines changed: 1028 additions & 197 deletions

File tree

‎gui/src/components/AddProviderModal.tsx‎

Lines changed: 264 additions & 49 deletions
Large diffs are not rendered by default.

‎gui/src/components/provider-catalog/ProviderCatalog.tsx‎

Lines changed: 151 additions & 97 deletions
Large diffs are not rendered by default.

‎gui/src/components/provider-catalog/provider-presets.ts‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
import { providerTier, type ProviderTier, type WorkspaceProvider } from "../../provider-workspace/catalog";
1010
import type { ProviderPayload } from "../../provider-payload";
1111

12+
export type ProviderAccessGroup =
13+
| "recurring-or-keyless"
14+
| "recurring-uncapped"
15+
| "recurring-credit"
16+
| "signup-credit";
17+
18+
export type ProviderSupportLevel = "supported" | "experimental" | "reference";
19+
1220
/** Row shape returned by GET /api/provider-presets (mirrors DerivedProviderPreset). */
1321
export interface CatalogPreset {
1422
id: string;
@@ -33,6 +41,53 @@ export interface CatalogPreset {
3341
baseUrlChoices?: Array<{ id: string; label: string; baseUrl?: string }>;
3442
codexAccountMode?: "direct" | "pool";
3543
provider?: ProviderPayload;
44+
accessGroups?: readonly ProviderAccessGroup[];
45+
supportLevel?: ProviderSupportLevel;
46+
verification?: "official" | "primary" | "unverified";
47+
documentationUrl?: string;
48+
modelsUrl?: string;
49+
discovery?: "live" | "static" | "hybrid" | "unsupported";
50+
lastVerified?: string;
51+
models?: string[];
52+
liveModels?: boolean;
53+
}
54+
55+
export const ACCESS_GROUPS: ProviderAccessGroup[] = [
56+
"recurring-or-keyless",
57+
"recurring-uncapped",
58+
"recurring-credit",
59+
"signup-credit",
60+
];
61+
62+
/** Curated free-directory rows. A provider may belong to more than one group. */
63+
export function curatedPresets(presets: CatalogPreset[]): CatalogPreset[] {
64+
return presets.filter(p => (p.accessGroups?.length ?? 0) > 0);
65+
}
66+
67+
export function accessGroupCounts(presets: CatalogPreset[]): Record<ProviderAccessGroup, number> {
68+
const counts = Object.fromEntries(ACCESS_GROUPS.map(group => [group, 0])) as Record<ProviderAccessGroup, number>;
69+
for (const preset of curatedPresets(presets)) {
70+
for (const group of new Set(preset.accessGroups)) counts[group] += 1;
71+
}
72+
return counts;
73+
}
74+
75+
export function filterByAccessGroup(presets: CatalogPreset[], group: ProviderAccessGroup | "all"): CatalogPreset[] {
76+
const curated = curatedPresets(presets);
77+
return group === "all" ? curated : curated.filter(p => p.accessGroups?.includes(group));
78+
}
79+
80+
/** Keep the requested directory at 81 while retaining legacy free/local presets in a separate lane. */
81+
export function freeCatalogSections(presets: CatalogPreset[]): { directory: CatalogPreset[]; existing: CatalogPreset[] } {
82+
const directory = curatedPresets(presets);
83+
const free = bucketPresets(presets).free;
84+
if (directory.length === 0) return { directory: free, existing: [] };
85+
const directoryIds = new Set(directory.map(preset => preset.id));
86+
return { directory, existing: free.filter(preset => !directoryIds.has(preset.id)) };
87+
}
88+
89+
export function isPresetActionable(preset: CatalogPreset): boolean {
90+
return preset.supportLevel !== "reference";
3691
}
3792

3893
/**

‎gui/src/i18n/de.ts‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,8 @@ export const de = {
554554
"modal.endpoint": "Endpunkt",
555555
"modal.endpoint.tokenPlan": "Token-Plan",
556556
"modal.endpoint.payAsYouGo": "Pay as you go",
557+
"modal.endpoint.chinaMainland": "Festlandchina",
558+
"modal.endpoint.international": "International",
557559
"modal.endpoint.custom": "Benutzerdefiniert",
558560
"modal.defaultModel": "Standardmodell (optional)",
559561
"modal.allowPrivateNetwork": "Lokales/privates Netzwerk erlauben",
@@ -997,6 +999,41 @@ export const de = {
997999
"time.minutesAgo": "vor {n} Min.",
9981000
"time.hoursAgo": "vor {n} Std.",
9991001
"time.daysAgo": "vor {n} T.",
1002+
"modal.catalogModes": "Zugriffsarten der Anbieter",
1003+
"modal.accessGroups": "Kostenlose Zugriffsgruppen",
1004+
"modal.providerDirectory": "Anbieterverzeichnis",
1005+
"modal.searchCount": "{count} Anbieter durchsuchen",
1006+
"modal.group.all": "Alle Anbieter",
1007+
"modal.group.recurring-or-keyless": "Regelmäßig / ohne Schlüssel",
1008+
"modal.group.recurring-uncapped": "Kein öffentliches Token-Limit",
1009+
"modal.group.recurring-credit": "Regelmäßiges Guthaben",
1010+
"modal.group.signup-credit": "Startguthaben",
1011+
"modal.group.existing": "Vorhandene kostenlose & lokale",
1012+
"modal.paidHint": "Kostenpflichtige Anbieter und Anbieter mit einmaligem Startguthaben durchsuchen.",
1013+
"modal.selectProvider": "Anbieter auswählen",
1014+
"modal.selectProviderHint": "Wähle einen Anbieter, um die Einrichtung anzusehen und Modelle zu suchen.",
1015+
"modal.badge.recurring": "Regelmäßig kostenlos",
1016+
"modal.badge.reference": "Referenz",
1017+
"modal.badge.experimental": "Experimentell",
1018+
"modal.badge.supported": "Unterstützt",
1019+
"modal.verification.official": "Offizielle Dokumentation",
1020+
"modal.verification.primary": "Primärquelle",
1021+
"modal.verification.unverified": "Nicht verifiziert",
1022+
"modal.providerDocs": "Anbieterdokumentation",
1023+
"modal.referenceExplanation": "Dieser Eintrag dient nur als Referenz. Automatische Aufrufe und die Modellsuche bleiben deaktiviert, bis ein dokumentierter Transportweg verifiziert wurde.",
1024+
"modal.modelDiscovery": "Modellsuche",
1025+
"modal.modelDiscoveryHint": "Verfügbare Modelle für diese Einrichtung suchen.",
1026+
"modal.discoverModels": "Modelle suchen",
1027+
"modal.discovering": "Suche läuft…",
1028+
"modal.modelsLive": "Live-Antwort des Anbieters",
1029+
"modal.modelsStatic": "Statischer Katalog",
1030+
"modal.discoveredModels": "Gefundene Modelle",
1031+
"modal.discoveryFailed": "Für diese Einrichtung konnten keine Modelle gefunden werden.",
1032+
"modal.backToDirectory": "Zurück zum Anbieterverzeichnis",
1033+
"modal.setupReviewProvider": "Einrichtungsdokumentation für {label} prüfen.",
1034+
"modal.setupReferenceStep": "Nutze diesen Eintrag als Einrichtungshilfe, bis verifizierte Aufrufunterstützung verfügbar ist.",
1035+
"modal.setupKeylessStep": "Bestätige den Endpunkt unten; ein API-Schlüssel ist optional.",
1036+
"modal.setupDiscoverStep": "Modelle suchen und ein Standardmodell auswählen.",
10001037
"modal.noMatch": "Kein Treffer.",
10011038
"modal.oauthDefaultNote": "Mit deinem Konto anmelden — kein API-Schlüssel nötig.",
10021039
"modal.oauthComingSoon": "OAuth-Login für {label} kommt im nächsten Update. Nutze vorerst einen API-Schlüssel.",

‎gui/src/i18n/en.ts‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,8 @@ export const en = {
611611
"modal.endpoint": "Endpoint",
612612
"modal.endpoint.tokenPlan": "Token plan",
613613
"modal.endpoint.payAsYouGo": "Pay as you go",
614+
"modal.endpoint.chinaMainland": "China mainland",
615+
"modal.endpoint.international": "International",
614616
"modal.endpoint.custom": "Custom",
615617
"modal.defaultModel": "Default model (optional)",
616618
"modal.allowPrivateNetwork": "Allow local/private network",
@@ -840,6 +842,41 @@ export const en = {
840842
"time.minutesAgo": "{n}m ago",
841843
"time.hoursAgo": "{n}h ago",
842844
"time.daysAgo": "{n}d ago",
845+
"modal.catalogModes": "Provider access modes",
846+
"modal.accessGroups": "Free access groups",
847+
"modal.providerDirectory": "Provider directory",
848+
"modal.searchCount": "Search {count} providers",
849+
"modal.group.all": "All providers",
850+
"modal.group.recurring-or-keyless": "Recurring / keyless",
851+
"modal.group.recurring-uncapped": "No public token cap",
852+
"modal.group.recurring-credit": "Recurring credits",
853+
"modal.group.signup-credit": "Signup credits",
854+
"modal.group.existing": "Existing free & local",
855+
"modal.paidHint": "Browse paid providers and providers with one-time signup credit.",
856+
"modal.selectProvider": "Select a provider",
857+
"modal.selectProviderHint": "Choose a provider to view setup and discover models.",
858+
"modal.badge.recurring": "Free recurring",
859+
"modal.badge.reference": "Reference",
860+
"modal.badge.experimental": "Experimental",
861+
"modal.badge.supported": "Supported",
862+
"modal.verification.official": "Official docs",
863+
"modal.verification.primary": "Primary source",
864+
"modal.verification.unverified": "Unverified",
865+
"modal.providerDocs": "Provider docs",
866+
"modal.referenceExplanation": "This entry is reference-only. Automated calling and model discovery remain disabled until a documented transport has been verified.",
867+
"modal.modelDiscovery": "Model discovery",
868+
"modal.modelDiscoveryHint": "Find available models for this setup.",
869+
"modal.discoverModels": "Discover models",
870+
"modal.discovering": "Discovering…",
871+
"modal.modelsLive": "Live provider response",
872+
"modal.modelsStatic": "Static catalog",
873+
"modal.discoveredModels": "Discovered models",
874+
"modal.discoveryFailed": "No models could be discovered for this setup.",
875+
"modal.backToDirectory": "Back to provider directory",
876+
"modal.setupReviewProvider": "Review the {label} setup documentation.",
877+
"modal.setupReferenceStep": "Use this entry as setup guidance until verified calling support is available.",
878+
"modal.setupKeylessStep": "Confirm the endpoint below; an API key is optional.",
879+
"modal.setupDiscoverStep": "Discover and choose a default model.",
843880
"modal.noMatch": "No match.",
844881
"modal.oauthDefaultNote": "Log in with your account — no API key needed.",
845882
"modal.oauthComingSoon": "OAuth login for {label} arrives in the next update. Use an API key for now.",

‎gui/src/i18n/ja.ts‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,8 @@ export const ja: Record<TKey, string> = {
576576
"modal.endpoint": "エンドポイント",
577577
"modal.endpoint.tokenPlan": "トークンプラン",
578578
"modal.endpoint.payAsYouGo": "従量課金",
579+
"modal.endpoint.chinaMainland": "中国本土",
580+
"modal.endpoint.international": "国際",
579581
"modal.endpoint.custom": "カスタム",
580582
"modal.defaultModel": "デフォルトモデル(任意)",
581583
"modal.allowPrivateNetwork": "ローカル/プライベートネットワークを許可",
@@ -795,6 +797,41 @@ export const ja: Record<TKey, string> = {
795797
"time.minutesAgo": "{n}分前",
796798
"time.hoursAgo": "{n}時間前",
797799
"time.daysAgo": "{n}日前",
800+
"modal.catalogModes": "プロバイダーのアクセス方式",
801+
"modal.accessGroups": "無料アクセスのグループ",
802+
"modal.providerDirectory": "プロバイダーディレクトリ",
803+
"modal.searchCount": "{count} 件のプロバイダーを検索",
804+
"modal.group.all": "すべてのプロバイダー",
805+
"modal.group.recurring-or-keyless": "定期無料 / キー不要",
806+
"modal.group.recurring-uncapped": "公開トークン上限なし",
807+
"modal.group.recurring-credit": "定期付与クレジット",
808+
"modal.group.signup-credit": "登録時クレジット",
809+
"modal.group.existing": "既存の無料・ローカル",
810+
"modal.paidHint": "有料プロバイダーと、登録時に一度だけクレジットが付与されるプロバイダーを参照します。",
811+
"modal.selectProvider": "プロバイダーを選択",
812+
"modal.selectProviderHint": "プロバイダーを選択して、設定の確認とモデルの検出を行います。",
813+
"modal.badge.recurring": "定期無料",
814+
"modal.badge.reference": "参考情報",
815+
"modal.badge.experimental": "試験的",
816+
"modal.badge.supported": "対応済み",
817+
"modal.verification.official": "公式ドキュメント",
818+
"modal.verification.primary": "一次情報",
819+
"modal.verification.unverified": "未検証",
820+
"modal.providerDocs": "プロバイダーのドキュメント",
821+
"modal.referenceExplanation": "この項目は参考情報のみです。文書化された通信方式が検証されるまで、自動呼び出しとモデル検出は無効です。",
822+
"modal.modelDiscovery": "モデル検出",
823+
"modal.modelDiscoveryHint": "この設定で利用可能なモデルを検索します。",
824+
"modal.discoverModels": "モデルを検出",
825+
"modal.discovering": "検出中…",
826+
"modal.modelsLive": "プロバイダーからのライブ応答",
827+
"modal.modelsStatic": "静的カタログ",
828+
"modal.discoveredModels": "検出されたモデル",
829+
"modal.discoveryFailed": "この設定でモデルを検出できませんでした。",
830+
"modal.backToDirectory": "プロバイダーディレクトリに戻る",
831+
"modal.setupReviewProvider": "{label} の設定ドキュメントを確認します。",
832+
"modal.setupReferenceStep": "検証済みの呼び出しに対応するまで、この項目を設定ガイドとして利用してください。",
833+
"modal.setupKeylessStep": "下記のエンドポイントを確認します。API キーは任意です。",
834+
"modal.setupDiscoverStep": "モデルを検出して、既定のモデルを選択します。",
798835
"modal.noMatch": "一致なし。",
799836
"modal.oauthDefaultNote": "アカウントでログイン — API キー不要です。",
800837
"modal.oauthComingSoon": "{label} の OAuth ログインは次回の更新で対応予定です。今は API キーをお使いください。",

‎gui/src/i18n/ko.ts‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,8 @@ export const ko: Record<TKey, string> = {
573573
"modal.endpoint": "엔드포인트",
574574
"modal.endpoint.tokenPlan": "토큰 플랜",
575575
"modal.endpoint.payAsYouGo": "종량제",
576+
"modal.endpoint.chinaMainland": "중국 본토",
577+
"modal.endpoint.international": "국제",
576578
"modal.endpoint.custom": "사용자 지정",
577579
"modal.defaultModel": "기본 모델(선택)",
578580
"modal.allowPrivateNetwork": "로컬/사설 네트워크 허용",
@@ -1019,6 +1021,41 @@ export const ko: Record<TKey, string> = {
10191021
"time.minutesAgo": "{n}분 전",
10201022
"time.hoursAgo": "{n}시간 전",
10211023
"time.daysAgo": "{n}일 전",
1024+
"modal.catalogModes": "프로바이더 접근 방식",
1025+
"modal.accessGroups": "무료 접근 그룹",
1026+
"modal.providerDirectory": "프로바이더 디렉터리",
1027+
"modal.searchCount": "프로바이더 {count}개 검색",
1028+
"modal.group.all": "모든 프로바이더",
1029+
"modal.group.recurring-or-keyless": "정기 무료 / 키 불필요",
1030+
"modal.group.recurring-uncapped": "공개 토큰 한도 없음",
1031+
"modal.group.recurring-credit": "정기 크레딧",
1032+
"modal.group.signup-credit": "가입 크레딧",
1033+
"modal.group.existing": "기존 무료 및 로컬",
1034+
"modal.paidHint": "유료 프로바이더와 가입 시 일회성 크레딧을 제공하는 프로바이더를 찾아보세요.",
1035+
"modal.selectProvider": "프로바이더 선택",
1036+
"modal.selectProviderHint": "프로바이더를 선택해 설정을 확인하고 모델을 검색하세요.",
1037+
"modal.badge.recurring": "정기 무료",
1038+
"modal.badge.reference": "참고 자료",
1039+
"modal.badge.experimental": "실험적",
1040+
"modal.badge.supported": "지원됨",
1041+
"modal.verification.official": "공식 문서",
1042+
"modal.verification.primary": "1차 출처",
1043+
"modal.verification.unverified": "검증되지 않음",
1044+
"modal.providerDocs": "프로바이더 문서",
1045+
"modal.referenceExplanation": "이 항목은 참고용입니다. 문서화된 전송 방식이 검증될 때까지 자동 호출과 모델 검색은 비활성화됩니다.",
1046+
"modal.modelDiscovery": "모델 검색",
1047+
"modal.modelDiscoveryHint": "이 설정에서 사용 가능한 모델을 찾습니다.",
1048+
"modal.discoverModels": "모델 검색",
1049+
"modal.discovering": "검색 중…",
1050+
"modal.modelsLive": "프로바이더 실시간 응답",
1051+
"modal.modelsStatic": "정적 카탈로그",
1052+
"modal.discoveredModels": "검색된 모델",
1053+
"modal.discoveryFailed": "이 설정에서 모델을 찾지 못했습니다.",
1054+
"modal.backToDirectory": "프로바이더 디렉터리로 돌아가기",
1055+
"modal.setupReviewProvider": "{label} 설정 문서를 확인하세요.",
1056+
"modal.setupReferenceStep": "검증된 호출 지원이 제공될 때까지 이 항목을 설정 안내로 사용하세요.",
1057+
"modal.setupKeylessStep": "아래 엔드포인트를 확인하세요. API 키는 선택 사항입니다.",
1058+
"modal.setupDiscoverStep": "모델을 검색하고 기본 모델을 선택하세요.",
10221059
"modal.noMatch": "일치 항목 없음.",
10231060
"modal.oauthDefaultNote": "계정으로 로그인 — API 키 불필요.",
10241061
"modal.oauthComingSoon": "{label} OAuth 로그인은 다음 업데이트에 제공됩니다. 지금은 API 키를 사용하세요.",

‎gui/src/i18n/ru.ts‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,8 @@ export const ru: Record<TKey, string> = {
611611
"modal.endpoint": "Конечная точка",
612612
"modal.endpoint.tokenPlan": "Пакет токенов",
613613
"modal.endpoint.payAsYouGo": "Оплата по факту",
614+
"modal.endpoint.chinaMainland": "Материковый Китай",
615+
"modal.endpoint.international": "Международный",
614616
"modal.endpoint.custom": "Своя",
615617
"modal.defaultModel": "Модель по умолчанию (необязательно)",
616618
"modal.allowPrivateNetwork": "Разрешить локальную/частную сеть",
@@ -840,6 +842,41 @@ export const ru: Record<TKey, string> = {
840842
"time.minutesAgo": "{n} мин назад",
841843
"time.hoursAgo": "{n} ч назад",
842844
"time.daysAgo": "{n} дн. назад",
845+
"modal.catalogModes": "Режимы доступа к провайдерам",
846+
"modal.accessGroups": "Группы бесплатного доступа",
847+
"modal.providerDirectory": "Каталог провайдеров",
848+
"modal.searchCount": "Поиск среди {count} провайдеров",
849+
"modal.group.all": "Все провайдеры",
850+
"modal.group.recurring-or-keyless": "Регулярно / без ключа",
851+
"modal.group.recurring-uncapped": "Без публичного лимита токенов",
852+
"modal.group.recurring-credit": "Регулярные кредиты",
853+
"modal.group.signup-credit": "Кредиты за регистрацию",
854+
"modal.group.existing": "Существующие бесплатные и локальные",
855+
"modal.paidHint": "Просматривайте платных провайдеров и провайдеров с разовым кредитом за регистрацию.",
856+
"modal.selectProvider": "Выберите провайдера",
857+
"modal.selectProviderHint": "Выберите провайдера, чтобы просмотреть настройку и найти модели.",
858+
"modal.badge.recurring": "Регулярно бесплатно",
859+
"modal.badge.reference": "Справка",
860+
"modal.badge.experimental": "Экспериментально",
861+
"modal.badge.supported": "Поддерживается",
862+
"modal.verification.official": "Официальная документация",
863+
"modal.verification.primary": "Первичный источник",
864+
"modal.verification.unverified": "Не проверено",
865+
"modal.providerDocs": "Документация провайдера",
866+
"modal.referenceExplanation": "Эта запись предназначена только для справки. Автоматические вызовы и поиск моделей останутся отключёнными, пока не будет проверен документированный способ подключения.",
867+
"modal.modelDiscovery": "Поиск моделей",
868+
"modal.modelDiscoveryHint": "Найдите модели, доступные для этой настройки.",
869+
"modal.discoverModels": "Найти модели",
870+
"modal.discovering": "Поиск…",
871+
"modal.modelsLive": "Ответ провайдера в реальном времени",
872+
"modal.modelsStatic": "Статический каталог",
873+
"modal.discoveredModels": "Найденные модели",
874+
"modal.discoveryFailed": "Не удалось найти модели для этой настройки.",
875+
"modal.backToDirectory": "Вернуться к каталогу провайдеров",
876+
"modal.setupReviewProvider": "Ознакомьтесь с документацией по настройке {label}.",
877+
"modal.setupReferenceStep": "Используйте эту запись как руководство по настройке, пока не появится поддержка проверенных вызовов.",
878+
"modal.setupKeylessStep": "Подтвердите конечную точку ниже; API-ключ необязателен.",
879+
"modal.setupDiscoverStep": "Найдите модели и выберите модель по умолчанию.",
843880
"modal.noMatch": "Ничего не найдено.",
844881
"modal.oauthDefaultNote": "Войдите со своим аккаунтом — API-ключ не нужен.",
845882
"modal.oauthComingSoon": "Вход через OAuth для {label} появится в следующем обновлении. Пока используйте API-ключ.",

0 commit comments

Comments
 (0)