mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-08 18:37:46 +08:00
feat(grok): add admin oauth and quota support
This commit is contained in:
@@ -4,9 +4,9 @@ pub(crate) fn normalize_provider_type_input(value: &str) -> Result<String, Strin
|
||||
let normalized = value.trim().to_ascii_lowercase();
|
||||
match normalized.as_str() {
|
||||
"custom" | "claude_code" | "kiro" | "codex" | "chatgpt_web" | "gemini_cli"
|
||||
| "antigravity" | "vertex_ai" => Ok(normalized),
|
||||
| "antigravity" | "vertex_ai" | "grok" => Ok(normalized),
|
||||
_ => Err(
|
||||
"provider_type 仅支持 custom / claude_code / kiro / codex / chatgpt_web / gemini_cli / antigravity / vertex_ai"
|
||||
"provider_type 仅支持 custom / claude_code / kiro / codex / chatgpt_web / gemini_cli / antigravity / vertex_ai / grok"
|
||||
.to_string(),
|
||||
),
|
||||
}
|
||||
@@ -260,6 +260,14 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn normalize_provider_type_supports_grok() {
|
||||
assert_eq!(
|
||||
normalize_provider_type_input(" Grok ").expect("type should normalize"),
|
||||
"grok"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn normalize_api_format_list_dedupes_canonical_formats() {
|
||||
assert_eq!(
|
||||
|
||||
@@ -205,7 +205,7 @@ pub(crate) async fn build_admin_update_provider_record(
|
||||
updated.stream_first_byte_timeout_secs = match payload.stream_first_byte_timeout {
|
||||
Some(value) if (1.0..=300.0).contains(&value) => Some(value),
|
||||
Some(_) => {
|
||||
return Err("stream_first_byte_timeout 必须是 1 到 300 之间的数字".to_string())
|
||||
return Err("stream_first_byte_timeout 必须是 1 到 300 之间的数字".to_string());
|
||||
}
|
||||
None => None,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user