Skip to content

Commit 5167f0c

Browse files
committed
feat(ai/openai): accept any OpenAI-compatible model; remove dead_code attr. refactor(ui,keyring): standardize Tauri args to snake_case for OpenAI test/save. chore(audio): keep mutable bindings in normalizer for future ops.
1 parent 673f612 commit 5167f0c

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

src-tauri/src/ai/openai.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ use serde::{Deserialize, Serialize};
66
use std::collections::HashMap;
77
use std::time::Duration;
88

9-
// Accept common OpenAI chat models. Keep minimal allowlist but include the requested one.
10-
const SUPPORTED_MODELS: &[&str] = &["gpt-5-nano", "gpt-5", "gpt-4.1-2025-04-14"];
11-
129
pub struct OpenAIProvider {
13-
#[allow(dead_code)]
1410
api_key: String,
1511
model: String,
1612
client: Client,
@@ -24,11 +20,7 @@ impl OpenAIProvider {
2420
model: String,
2521
mut options: HashMap<String, serde_json::Value>,
2622
) -> Result<Self, AIError> {
27-
// Validate model (allow if in list; otherwise accept for forward compatibility)
28-
if !SUPPORTED_MODELS.contains(&model.as_str()) {
29-
// Don’t hard fail; just log a warning and continue
30-
log::warn!("OpenAI model not in local allowlist: {}", model);
31-
}
23+
// Do not restrict model IDs; accept any OpenAI-compatible model string
3224

3325
// Determine if auth is required
3426
let no_auth = options

src/components/OpenAICompatConfigModal.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,11 @@ export function OpenAICompatConfigModal({
6565
try {
6666
const computedNoAuth = apiKey.trim() === "";
6767
await invoke("test_openai_endpoint", {
68-
// Provide both snake_case and camelCase for compatibility with backend param names
68+
// Standardize to snake_case for Tauri command args
6969
base_url: baseUrl.trim(),
70-
baseUrl: baseUrl.trim(),
7170
model: model.trim(),
7271
api_key: computedNoAuth ? undefined : apiKey.trim(),
73-
apiKey: computedNoAuth ? undefined : apiKey.trim(),
7472
no_auth: computedNoAuth,
75-
noAuth: computedNoAuth,
7673
});
7774
setTestResult({ ok: true, message: "Connection successful" });
7875
} catch (e: any) {

src/utils/keyring.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,11 @@ export const saveOpenAIKeyWithConfig = async (
115115

116116
await invoke('validate_and_cache_api_key', {
117117
provider,
118-
// Send both camelCase and snake_case keys for compatibility
119-
apiKey: apiKey || undefined,
118+
// Standardize to snake_case for Tauri commands
120119
api_key: apiKey || undefined,
121120
base_url: baseUrl,
122-
baseUrl: baseUrl,
123121
model,
124122
no_auth: noAuth || !apiKey?.trim(),
125-
noAuth: noAuth || !apiKey?.trim(),
126123
});
127124

128125
// Persist provider + model selection

0 commit comments

Comments
 (0)