[codex] rename site API request wording (#423)

* rename site api request wording

* replace real site example domains
This commit is contained in:
Cita
2026-04-05 19:16:08 +08:00
committed by GitHub
parent 5b005d8412
commit ef1962d10b
15 changed files with 84 additions and 67 deletions
@@ -138,21 +138,21 @@ describe('refreshModelsForAccount credential discovery', () => {
it('uses the configured ai endpoint for direct model discovery credentials', async () => {
getApiTokenMock.mockResolvedValue(null);
getModelsMock.mockImplementation(async (baseUrl: string, token: string) => (
baseUrl === 'https://api.nih.cc' && token === 'session-token'
baseUrl === 'https://api.example.com' && token === 'session-token'
? ['gpt-4.1']
: []
));
const site = await db.insert(schema.sites).values({
name: 'nihao-panel',
url: 'https://nih.cc',
url: 'https://console.example.com',
platform: 'new-api',
status: 'active',
}).returning().get();
await db.insert(schema.siteApiEndpoints).values({
siteId: site.id,
url: 'https://api.nih.cc',
url: 'https://api.example.com',
enabled: true,
sortOrder: 0,
}).run();
@@ -175,7 +175,7 @@ describe('refreshModelsForAccount credential discovery', () => {
modelCount: 1,
modelsPreview: ['gpt-4.1'],
});
expect(getModelsMock).toHaveBeenCalledWith('https://api.nih.cc', 'session-token', undefined);
expect(getModelsMock).toHaveBeenCalledWith('https://api.example.com', 'session-token', undefined);
});
it('deduplicates discovered model names before writing availability rows', async () => {
@@ -207,7 +207,7 @@ export async function requireSiteApiBaseUrl(
): Promise<string> {
const baseUrl = await resolveSiteApiBaseUrl(site, now);
if (baseUrl) return baseUrl;
throw new Error('当前站点的 AI 请求地址均不可用');
throw new Error('当前站点的 API 请求地址均不可用');
}
export async function recordSiteApiEndpointFailure(
@@ -258,11 +258,11 @@ export async function runWithSiteApiEndpointPool<T>(
const target = await selectSiteApiEndpointTarget(site);
if (!target) {
if (lastError) throw lastError;
throw new Error('当前站点的 AI 请求地址均不可用');
throw new Error('当前站点的 API 请求地址均不可用');
}
if (target.endpointId && attemptedEndpointIds.has(target.endpointId)) {
if (lastError) throw lastError;
throw new Error('当前站点的 AI 请求地址均不可用');
throw new Error('当前站点的 API 请求地址均不可用');
}
try {