gemini优化

This commit is contained in:
IndieKKY
2025-05-05 22:43:00 +08:00
parent 774cc2726d
commit 3ad198948f
3 changed files with 13 additions and 1 deletions

View File

@@ -7,6 +7,10 @@ const getServerUrl = (serverUrl?: string) => {
if (serverUrl.endsWith('/')) {
serverUrl = serverUrl.slice(0, -1)
}
//如果serverUrl以https://generativelanguage.googleapis.com开头则直接返回
if (serverUrl.toLowerCase().startsWith('https://generativelanguage.googleapis.com')) {
return serverUrl
}
//如果serverUrl不以/vxxx结尾则添加/v1
if (!/\/v\d+$/.test(serverUrl.toLowerCase())) {
serverUrl += '/v1'