Spaces:
Sleeping
Sleeping
Download server/src/proxy/common/utils.rs from doasyousay/gemini: direct link, hf CLI and curl.
- Browser
- Download file 543 Bytes
-
https://huggingface.co/spaces/doasyousay/gemini/resolve/main/server/src/proxy/common/utils.rs
- Command line
-
hf download hf://spaces/doasyousay/gemini/server/src/proxy/common/utils.rs
-
curl -L -o utils.rs https://huggingface.co/spaces/doasyousay/gemini/resolve/main/server/src/proxy/common/utils.rs
543 Bytes
| // 工具函数 | |
| pub fn generate_random_id() -> String { | |
| use rand::Rng; | |
| rand::thread_rng() | |
| .sample_iter(&rand::distributions::Alphanumeric) | |
| .take(8) | |
| .map(char::from) | |
| .collect() | |
| } | |
| /// 根据模型名称推测功能类型 | |
| // 注意:此函数已弃用,请改用 mappers::common_utils::resolve_request_config | |
| pub fn _deprecated_infer_quota_group(model: &str) -> String { | |
| if model.to_lowercase().starts_with("claude") { | |
| "claude".to_string() | |
| } else { | |
| "gemini".to_string() | |
| } | |
| } | |