Skip to content

Commit 7f105db

Browse files
committed
Requesty: Add button to flush cached models
1 parent b410fb6 commit 7f105db

File tree

17 files changed

+53
-1
lines changed

17 files changed

+53
-1
lines changed

webview-ui/src/components/settings/ApiOptions.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ const ApiOptions = ({
8585
return Object.entries(headers)
8686
})
8787

88+
const [requestyShowRefreshHint, setRequestyShowRefreshHint] = useState<boolean>()
89+
8890
useEffect(() => {
8991
const propHeaders = apiConfiguration?.openAiHeaders || {}
9092

@@ -190,7 +192,7 @@ const ApiOptions = ({
190192
info: selectedModelInfo,
191193
} = useSelectedModel(apiConfiguration)
192194

193-
const { data: routerModels } = useRouterModels()
195+
const { data: routerModels, refetch: refetchRouterModels } = useRouterModels()
194196

195197
// Update apiConfiguration.aiModelId whenever selectedModelId changes.
196198
useEffect(() => {
@@ -575,6 +577,24 @@ const ApiOptions = ({
575577
{t("settings:providers.getRequestyApiKey")}
576578
</VSCodeButtonLink>
577579
)}
580+
<Button
581+
variant="outline"
582+
title={t("settings:providers.refetchModels")}
583+
onClick={() => {
584+
vscode.postMessage({ type: "flushRouterModels", text: "requesty" })
585+
refetchRouterModels()
586+
setRequestyShowRefreshHint(true)
587+
}}>
588+
<div className="flex items-center gap-2">
589+
<span className="codicon codicon-refresh" />
590+
{t("settings:providers.flushModelsCache")}
591+
</div>
592+
</Button>
593+
{requestyShowRefreshHint && (
594+
<div className="flex items-center text-vscode-errorForeground">
595+
{t("settings:providers.flushedModelsCache")}
596+
</div>
597+
)}
578598
</>
579599
)}
580600

webview-ui/src/i18n/locales/ca/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@
119119
"glamaApiKey": "Clau API de Glama",
120120
"getGlamaApiKey": "Obtenir clau API de Glama",
121121
"requestyApiKey": "Clau API de Requesty",
122+
"flushModelsCache": "Netejar memòria cau de models",
123+
"flushedModelsCache": "Memòria cau netejada, si us plau torna a obrir la vista de configuració",
122124
"getRequestyApiKey": "Obtenir clau API de Requesty",
123125
"anthropicApiKey": "Clau API d'Anthropic",
124126
"getAnthropicApiKey": "Obtenir clau API d'Anthropic",

webview-ui/src/i18n/locales/de/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@
106106
"awsCustomArnUse": "Geben Sie eine gültige Amazon Bedrock ARN für das Modell ein, das Sie verwenden möchten. Formatbeispiele:",
107107
"awsCustomArnDesc": "Stellen Sie sicher, dass die Region in der ARN mit Ihrer oben ausgewählten AWS-Region übereinstimmt.",
108108
"openRouterApiKey": "OpenRouter API-Schlüssel",
109+
"flushModelsCache": "Modell-Cache leeren",
110+
"flushedModelsCache": "Cache geleert, bitte öffnen Sie die Einstellungsansicht erneut",
109111
"getOpenRouterApiKey": "OpenRouter API-Schlüssel erhalten",
110112
"apiKeyStorageNotice": "API-Schlüssel werden sicher im VSCode Secret Storage gespeichert",
111113
"glamaApiKey": "Glama API-Schlüssel",

webview-ui/src/i18n/locales/en/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@
118118
"headerValue": "Header value",
119119
"noCustomHeaders": "No custom headers defined. Click the + button to add one.",
120120
"requestyApiKey": "Requesty API Key",
121+
"flushModelsCache": "Flush cached models",
122+
"flushedModelsCache": "Flushed cache, please reopen the settings view",
121123
"getRequestyApiKey": "Get Requesty API Key",
122124
"openRouterTransformsText": "Compress prompts and message chains to the context size (<a>OpenRouter Transforms</a>)",
123125
"anthropicApiKey": "Anthropic API Key",

webview-ui/src/i18n/locales/es/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@
106106
"awsCustomArnUse": "Ingrese un ARN de Amazon Bedrock válido para el modelo que desea utilizar. Ejemplos de formato:",
107107
"awsCustomArnDesc": "Asegúrese de que la región en el ARN coincida con la región de AWS seleccionada anteriormente.",
108108
"openRouterApiKey": "Clave API de OpenRouter",
109+
"flushModelsCache": "Limpiar modelos en caché",
110+
"flushedModelsCache": "Caché limpiada, por favor vuelva a abrir la vista de configuración",
109111
"getOpenRouterApiKey": "Obtener clave API de OpenRouter",
110112
"apiKeyStorageNotice": "Las claves API se almacenan de forma segura en el Almacenamiento Secreto de VSCode",
111113
"glamaApiKey": "Clave API de Glama",

webview-ui/src/i18n/locales/fr/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@
106106
"awsCustomArnUse": "Entrez un ARN Amazon Bedrock valide pour le modèle que vous souhaitez utiliser. Exemples de format :",
107107
"awsCustomArnDesc": "Assurez-vous que la région dans l'ARN correspond à la région AWS sélectionnée ci-dessus.",
108108
"openRouterApiKey": "Clé API OpenRouter",
109+
"flushModelsCache": "Vider le cache des modèles",
110+
"flushedModelsCache": "Cache vidé, veuillez rouvrir la vue des paramètres",
109111
"getOpenRouterApiKey": "Obtenir la clé API OpenRouter",
110112
"apiKeyStorageNotice": "Les clés API sont stockées en toute sécurité dans le stockage sécurisé de VSCode",
111113
"glamaApiKey": "Clé API Glama",

webview-ui/src/i18n/locales/hi/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@
118118
"headerValue": "हेडर मूल्य",
119119
"noCustomHeaders": "कोई कस्टम हेडर परिभाषित नहीं है। एक जोड़ने के लिए + बटन पर क्लिक करें।",
120120
"requestyApiKey": "Requesty API कुंजी",
121+
"flushModelsCache": "मॉडल कैश साफ़ करें",
122+
"flushedModelsCache": "कैश साफ़ किया गया, कृपया सेटिंग्स व्यू को फिर से खोलें",
121123
"getRequestyApiKey": "Requesty API कुंजी प्राप्त करें",
122124
"openRouterTransformsText": "संदर्भ आकार के लिए प्रॉम्प्ट और संदेश श्रृंखलाओं को संपीड़ित करें (<a>OpenRouter ट्रांसफॉर्म</a>)",
123125
"anthropicApiKey": "Anthropic API कुंजी",

webview-ui/src/i18n/locales/it/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@
118118
"headerValue": "Valore intestazione",
119119
"noCustomHeaders": "Nessuna intestazione personalizzata definita. Fai clic sul pulsante + per aggiungerne una.",
120120
"requestyApiKey": "Chiave API Requesty",
121+
"flushModelsCache": "Svuota cache dei modelli",
122+
"flushedModelsCache": "Cache svuotata, riapri la vista delle impostazioni",
121123
"getRequestyApiKey": "Ottieni chiave API Requesty",
122124
"openRouterTransformsText": "Comprimi prompt e catene di messaggi alla dimensione del contesto (<a>Trasformazioni OpenRouter</a>)",
123125
"anthropicApiKey": "Chiave API Anthropic",

webview-ui/src/i18n/locales/ja/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@
118118
"headerValue": "ヘッダー値",
119119
"noCustomHeaders": "カスタムヘッダーが定義されていません。+ ボタンをクリックして追加してください。",
120120
"requestyApiKey": "Requesty APIキー",
121+
"flushModelsCache": "モデルキャッシュをクリア",
122+
"flushedModelsCache": "キャッシュをクリアしました。設定ビューを再開してください",
121123
"getRequestyApiKey": "Requesty APIキーを取得",
122124
"openRouterTransformsText": "プロンプトとメッセージチェーンをコンテキストサイズに圧縮 (<a>OpenRouter Transforms</a>)",
123125
"anthropicApiKey": "Anthropic APIキー",

webview-ui/src/i18n/locales/ko/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@
118118
"headerValue": "헤더 값",
119119
"noCustomHeaders": "정의된 사용자 정의 헤더가 없습니다. + 버튼을 클릭하여 추가하세요.",
120120
"requestyApiKey": "Requesty API 키",
121+
"flushModelsCache": "모델 캐시 지우기",
122+
"flushedModelsCache": "캐시가 지워졌습니다. 설정 보기를 다시 열어주세요",
121123
"getRequestyApiKey": "Requesty API 키 받기",
122124
"openRouterTransformsText": "프롬프트와 메시지 체인을 컨텍스트 크기로 압축 (<a>OpenRouter Transforms</a>)",
123125
"anthropicApiKey": "Anthropic API 키",

0 commit comments

Comments
 (0)