-
Notifications
You must be signed in to change notification settings - Fork 186
fix(llm): 允许无密钥 LLM 配置 #193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
0fe00ce
1d0dcef
7e36d07
b85006c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1589,9 +1589,6 @@ async fn polish_text( | |
| front_app: Option<&str>, | ||
| ) -> anyhow::Result<String> { | ||
| let api_key = CredentialsVault::get(CredentialAccount::ArkApiKey)?.unwrap_or_default(); | ||
| if api_key.is_empty() { | ||
| anyhow::bail!("ark api key missing"); | ||
| } | ||
| let model = CredentialsVault::get(CredentialAccount::ArkModelId)? | ||
| .filter(|s| !s.is_empty()) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In Useful? React with 👍 / 👎. |
||
| .unwrap_or_else(|| "deepseek-v3-2".to_string()); | ||
|
|
@@ -1634,9 +1631,6 @@ async fn translate_text( | |
| front_app: Option<&str>, | ||
| ) -> anyhow::Result<String> { | ||
| let api_key = CredentialsVault::get(CredentialAccount::ArkApiKey)?.unwrap_or_default(); | ||
| if api_key.is_empty() { | ||
| anyhow::bail!("ark api key missing"); | ||
| } | ||
| let model = CredentialsVault::get(CredentialAccount::ArkModelId)? | ||
| .filter(|s| !s.is_empty()) | ||
| .unwrap_or_else(|| "deepseek-v3-2".to_string()); | ||
|
|
@@ -2154,9 +2148,6 @@ where | |
| C: Fn() -> bool + Send + Sync, | ||
| { | ||
| let api_key = CredentialsVault::get(CredentialAccount::ArkApiKey)?.unwrap_or_default(); | ||
| if api_key.is_empty() { | ||
| anyhow::bail!("ark api key missing"); | ||
| } | ||
| let model = CredentialsVault::get(CredentialAccount::ArkModelId)? | ||
| .filter(|s| !s.is_empty()) | ||
| .unwrap_or_else(|| "deepseek-v3-2".to_string()); | ||
|
|
@@ -2170,7 +2161,13 @@ where | |
| let config = OpenAICompatibleConfig::new("ark", "Doubao Ark", base_url, api_key, model); | ||
| let provider = OpenAICompatibleLLMProvider::new(config); | ||
| Ok(provider | ||
| .answer_chat_streaming(messages, working_languages, front_app, on_delta, should_cancel) | ||
| .answer_chat_streaming( | ||
| messages, | ||
| working_languages, | ||
| front_app, | ||
| on_delta, | ||
| should_cancel, | ||
| ) | ||
| .await?) | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change allows empty API keys for
llm, but the model-listing path still unconditionally sendsAuthorization: Bearer {api_key}infetch_provider_models. When the key is empty, some OpenAI-compatible endpoints reject the empty Bearer credential, so the Settings “Fetch models” flow fails even though keyless LLM polish/validation now works. Please make model discovery omitAuthorizationwhen the key is blank, matching the new keyless behavior.Useful? React with 👍 / 👎.