mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-13 04:29:50 +08:00
Update endpoint base URL placeholders
This commit is contained in:
@@ -147,7 +147,7 @@
|
|||||||
<Label class="text-xs text-muted-foreground">Base URL</Label>
|
<Label class="text-xs text-muted-foreground">Base URL</Label>
|
||||||
<Input
|
<Input
|
||||||
:model-value="getEndpointEditState(endpoint.id)?.url ?? endpoint.base_url"
|
:model-value="getEndpointEditState(endpoint.id)?.url ?? endpoint.base_url"
|
||||||
:placeholder="provider?.website || 'https://api.example.com'"
|
:placeholder="getEndpointBaseUrlPlaceholder(endpoint.api_format)"
|
||||||
:disabled="isFixedProvider"
|
:disabled="isFixedProvider"
|
||||||
@update:model-value="(v) => updateEndpointField(endpoint.id, 'url', v)"
|
@update:model-value="(v) => updateEndpointField(endpoint.id, 'url', v)"
|
||||||
/>
|
/>
|
||||||
@@ -965,7 +965,7 @@
|
|||||||
<Input
|
<Input
|
||||||
v-model="newEndpoint.base_url"
|
v-model="newEndpoint.base_url"
|
||||||
size="sm"
|
size="sm"
|
||||||
:placeholder="provider?.website || 'https://api.example.com'"
|
:placeholder="newEndpointBaseUrlPlaceholder"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="space-y-1.5">
|
<div class="space-y-1.5">
|
||||||
@@ -1811,6 +1811,8 @@ const newEndpoint = ref({
|
|||||||
// API 格式列表
|
// API 格式列表
|
||||||
const apiFormats = ref<Array<{ value: string; label: string; default_path: string }>>([])
|
const apiFormats = ref<Array<{ value: string; label: string; default_path: string }>>([])
|
||||||
|
|
||||||
|
const fallbackEndpointBaseUrl = 'https://api.example.com'
|
||||||
|
|
||||||
// 本地端点列表
|
// 本地端点列表
|
||||||
const localEndpoints = ref<ProviderEndpoint[]>([])
|
const localEndpoints = ref<ProviderEndpoint[]>([])
|
||||||
|
|
||||||
@@ -1886,6 +1888,14 @@ function getEndpointDefaultPath(endpoint: ProviderEndpoint): string {
|
|||||||
return getDefaultPath(endpoint.api_format, getEndpointEditState(endpoint.id)?.url ?? endpoint.base_url)
|
return getDefaultPath(endpoint.api_format, getEndpointEditState(endpoint.id)?.url ?? endpoint.base_url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getEndpointBaseUrlPlaceholder(apiFormat: string): string {
|
||||||
|
const seedBaseUrl = (props.provider?.website || fallbackEndpointBaseUrl).trim()
|
||||||
|
return getDefaultEndpointBaseUrl({
|
||||||
|
apiFormat,
|
||||||
|
baseUrl: seedBaseUrl,
|
||||||
|
}) || seedBaseUrl
|
||||||
|
}
|
||||||
|
|
||||||
function getNewEndpointBaseUrl(): string {
|
function getNewEndpointBaseUrl(): string {
|
||||||
const typedBaseUrl = newEndpoint.value.base_url.trim()
|
const typedBaseUrl = newEndpoint.value.base_url.trim()
|
||||||
if (typedBaseUrl) return typedBaseUrl
|
if (typedBaseUrl) return typedBaseUrl
|
||||||
@@ -1895,6 +1905,10 @@ function getNewEndpointBaseUrl(): string {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const newEndpointBaseUrlPlaceholder = computed(() => {
|
||||||
|
return getEndpointBaseUrlPlaceholder(newEndpoint.value.api_format)
|
||||||
|
})
|
||||||
|
|
||||||
function getDisplayedPath(endpoint: ProviderEndpoint): string {
|
function getDisplayedPath(endpoint: ProviderEndpoint): string {
|
||||||
return getEndpointEditState(endpoint.id)?.path ?? (endpoint.custom_path || '')
|
return getEndpointEditState(endpoint.id)?.path ?? (endpoint.custom_path || '')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user