(provider: &ProviderState)
| 2170 | } |
| 2171 | |
| 2172 | fn provider_base_url(provider: &ProviderState) -> Option<String> { |
| 2173 | provider_option_string(provider, &["baseURL", "baseUrl", "url", "api"]).or_else(|| { |
| 2174 | provider |
| 2175 | .models |
| 2176 | .values() |
| 2177 | .find_map(|model| (!model.api.url.trim().is_empty()).then(|| model.api.url.clone())) |
| 2178 | }) |
| 2179 | .or_else(|| { |
| 2180 | // GLM Coding Plan requires a dedicated endpoint instead of the generic API. |
| 2181 | // TS users commonly configure this as provider id `zhipuai-coding-plan`. |
| 2182 | if provider.id == "zhipuai-coding-plan" { |
| 2183 | Some("https://open.bigmodel.cn/api/coding/paas/v4".to_string()) |
| 2184 | } else { |
| 2185 | None |
| 2186 | } |
| 2187 | }) |
| 2188 | } |
| 2189 | |
| 2190 | fn create_concrete_provider( |
| 2191 | provider_id: &str, |
no test coverage detected