fix(provider): refine endpoint default paths for openai and claude roots

This commit is contained in:
zhefox
2026-05-26 16:50:36 +08:00
parent 23a36e37bb
commit aa409a8a9c
7 changed files with 226 additions and 33 deletions
@@ -153,10 +153,17 @@
<Label class="text-xs text-muted-foreground">自定义路径</Label>
<Input
:model-value="getDisplayedPath(endpoint)"
:placeholder="getDefaultPath(endpoint.api_format, getEndpointEditState(endpoint.id)?.url ?? endpoint.base_url) || '留空使用默认'"
:placeholder="getEndpointDefaultPath(endpoint) || '留空使用默认'"
:disabled="isFixedProvider"
@update:model-value="(v) => updateEndpointField(endpoint.id, 'path', v)"
/>
<p
v-if="getEndpointDefaultPath(endpoint)"
class="text-[10px] text-muted-foreground truncate"
:title="getEndpointDefaultPath(endpoint)"
>
当前默认路径:{{ getEndpointDefaultPath(endpoint) }}
</p>
</div>
</div>
<!-- 保存/撤销按钮(URL/路径有修改时显示) -->
@@ -963,6 +970,13 @@
size="sm"
:placeholder="newEndpointDefaultPath || '留空使用默认'"
/>
<p
v-if="newEndpointDefaultPath"
class="text-[10px] text-muted-foreground truncate"
:title="newEndpointDefaultPath"
>
当前默认路径:{{ newEndpointDefaultPath }}
</p>
</div>
</div>
</div>
@@ -1859,6 +1873,10 @@ function getDefaultPath(apiFormat: string, baseUrl?: string): string {
})
}
function getEndpointDefaultPath(endpoint: ProviderEndpoint): string {
return getDefaultPath(endpoint.api_format, getEndpointEditState(endpoint.id)?.url ?? endpoint.base_url)
}
function getDisplayedPath(endpoint: ProviderEndpoint): string {
if (isFixedProvider.value) {
return getDefaultPath(endpoint.api_format, endpoint.base_url)