| 1 | export function providerSupportsServerWebSearch(kind: string, baseUrl: string): boolean { |
| 2 | try { |
| 3 | const endpoint = new URL(baseUrl.trim()); |
| 4 | if ( |
| 5 | endpoint.protocol !== "https:" || |
| 6 | endpoint.hostname.toLowerCase() !== "api.deepseek.com" || |
| 7 | endpoint.port || |
| 8 | endpoint.username || |
| 9 | endpoint.password || |
| 10 | endpoint.search || |
| 11 | endpoint.hash |
| 12 | ) return false; |
| 13 | const path = endpoint.pathname.replace(/\/+$/, ""); |
| 14 | switch (kind.trim().toLowerCase()) { |
| 15 | case "openai": |
| 16 | return path === "" || path === "/v1"; |
| 17 | case "responses": |
| 18 | return path === ""; |
| 19 | case "anthropic": |
| 20 | return path === "/anthropic"; |
| 21 | default: |
| 22 | return false; |
| 23 | } |
| 24 | } catch { |
| 25 | return false; |
| 26 | } |
| 27 | } |
| 28 |