[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
+9 -9
View File
@@ -517,7 +517,7 @@ export default function Sites() {
}
const serializedApiEndpoints = serializeSiteApiEndpoints(form.apiEndpoints);
if (!serializedApiEndpoints.valid) {
toast.error(serializedApiEndpoints.error || 'AI 请求地址格式不正确');
toast.error(serializedApiEndpoints.error || 'API 请求地址格式不正确');
return;
}
@@ -1028,7 +1028,7 @@ export default function Sites() {
<div style={{ display: 'flex', gap: 8, flexDirection: isMobile ? 'column' : 'row' }}>
<input
data-testid="site-primary-url-input"
placeholder="站点 URL(面板/登录/签到地址,如 https://nih.cc)"
placeholder="站点 URL(面板/登录/签到地址,如 https://console.example.com)"
value={form.url}
onChange={(e) => setForm((prev) => ({ ...prev, url: e.target.value }))}
onBlur={() => {
@@ -1102,7 +1102,7 @@ export default function Sites() {
</div>
)}
<div style={{ fontSize: 12, color: 'var(--color-text-muted)', lineHeight: 1.6 }}>
主站点 URL 用于登录、签到、面板接口和系统访问令牌管理;如果 AI 请求地址和主站点不同,请在下面的 AI 请求地址池里填写。
主站点 URL 用于登录、签到、面板接口和系统访问令牌管理;如果 API 请求地址和主站点不同,请在下面的 API 请求地址池里填写。
</div>
<div
style={{
@@ -1117,7 +1117,7 @@ export default function Sites() {
>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: 8, flexWrap: 'wrap' }}>
<div style={{ fontSize: 13, fontWeight: 600 }}>
AI 请求地址池
API 请求地址池
</div>
<button
type="button"
@@ -1125,7 +1125,7 @@ export default function Sites() {
className="btn btn-ghost"
style={{ border: '1px solid var(--color-border)' }}
>
+ 添加 AI 地址
+ 添加 API 地址
</button>
</div>
<div style={{ fontSize: 12, color: 'var(--color-text-muted)', lineHeight: 1.7 }}>
@@ -1146,7 +1146,7 @@ export default function Sites() {
>
<div style={{ display: 'flex', gap: 8, flexDirection: isMobile ? 'column' : 'row', alignItems: isMobile ? 'stretch' : 'center' }}>
<input
placeholder="AI 请求地址(如 https://api.nih.cc)"
placeholder="API 请求地址(如 https://api.example.com)"
value={endpoint.url}
onChange={(e) => updateApiEndpointRow(index, { url: e.target.value })}
style={{ ...formInputStyle, flex: 1, fontFamily: 'var(--font-mono)' }}
@@ -1405,7 +1405,7 @@ export default function Sites() {
style={formInputStyle}
/>
<div style={{ fontSize: 12, color: 'var(--color-text-muted)' }}>
这里只是 HTTP/SOCKS 代理地址,不是上游 AI API 地址。填写后优先使用站点代理;留空则使用系统代理或直连(取决于设置开关状态)。
这里只是 HTTP/SOCKS 代理地址,不是上游 API 请求地址。填写后优先使用站点代理;留空则使用系统代理或直连(取决于设置开关状态)。
</div>
</div>
<label style={{
@@ -1556,7 +1556,7 @@ export default function Sites() {
) : '-'}
/>
<MobileField
label="AI 请求地址"
label="API 请求地址"
stacked
value={(
<div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
@@ -1716,7 +1716,7 @@ export default function Sites() {
</span>
) : null}
<span className={`badge ${getConfiguredSiteApiEndpoints(site).length > 0 ? 'badge-warning' : 'badge-muted'}`} style={{ fontSize: 11 }}>
AI 地址: {buildSiteApiEndpointSummary(site)}
API 地址: {buildSiteApiEndpointSummary(site)}
</span>
</div>
</td>
+1 -1
View File
@@ -191,7 +191,7 @@ describe('buildSiteSaveAction', () => {
])).toEqual({
valid: false,
apiEndpoints: [],
error: 'AI 请求地址 "https://api.example.com" 重复了',
error: 'API 请求地址 "https://api.example.com" 重复了',
});
});
});
+1 -1
View File
@@ -225,7 +225,7 @@ export function serializeSiteApiEndpoints(fields: SiteApiEndpointField[]): {
return {
valid: false,
apiEndpoints: [],
error: `AI 请求地址 "${normalizedUrl}" 重复了`,
error: `API 请求地址 "${normalizedUrl}" 重复了`,
};
}
seen.add(normalizedUrl);
@@ -10,4 +10,21 @@ describe('Sites centered modal adoption', () => {
expect(source).toContain('<CenteredModal');
expect(source).not.toContain('editorPresence.shouldRender && activeEditor && (');
});
it('uses API request wording for dedicated site endpoint copy', () => {
const source = readFileSync(resolve(process.cwd(), 'src/web/pages/Sites.tsx'), 'utf8');
expect(source).toContain('API 请求地址池');
expect(source).toContain('+ 添加 API 地址');
expect(source).toContain('站点 URL(面板/登录/签到地址,如 https://console.example.com)');
expect(source).toContain('API 请求地址(如 https://api.example.com)');
expect(source).toContain('label="API 请求地址"');
expect(source).toContain('API 地址: {buildSiteApiEndpointSummary(site)}');
expect(source).not.toContain('nih.cc');
expect(source).not.toContain('api.nih.cc');
expect(source).not.toContain('AI 请求地址池');
expect(source).not.toContain('+ 添加 AI 地址');
expect(source).not.toContain('label="AI 请求地址"');
expect(source).not.toContain('AI 地址: {buildSiteApiEndpointSummary(site)}');
});
});