163b2fa077
Introduce centralized model pricing for editor generations: add EditorGenerationPricing types and admin API client methods (GET/POST), backend default config and runtime override support, and server route/handler changes to expose admin editor-generation-pricing. Add an AdminEditorGenerationPricingPage component, styles, route entry, icon, and tests, plus a test for admin routes. Update docs and decision log to describe the pricing contract and management workflow. This enables managing per-model pricing (perGeneration / perSecond, flat or tiered) from the admin panel and exposes runtime pricing to the main site.
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import {expect, test} from 'vitest';
|
|
|
|
import {adminRoutes, resolveAdminRoute, routeHash} from './adminRoutes';
|
|
|
|
// 中文注释:后台入口公告必须作为独立导航存在,避免公告表单被误藏在入口开关页。
|
|
test('后台入口公告路由可通过导航和 hash 访问', () => {
|
|
expect(adminRoutes).toContainEqual({
|
|
id: 'creation-announcement',
|
|
label: '入口公告',
|
|
hash: '#creation-announcement',
|
|
});
|
|
expect(resolveAdminRoute('#creation-announcement')).toBe(
|
|
'creation-announcement',
|
|
);
|
|
expect(routeHash('creation-announcement')).toBe('#creation-announcement');
|
|
});
|
|
|
|
test('后台模型定价路由可通过导航和 hash 访问', () => {
|
|
expect(adminRoutes).toContainEqual({
|
|
id: 'editor-generation-pricing',
|
|
label: '模型定价',
|
|
hash: '#editor-generation-pricing',
|
|
});
|
|
expect(resolveAdminRoute('#editor-generation-pricing')).toBe(
|
|
'editor-generation-pricing',
|
|
);
|
|
expect(routeHash('editor-generation-pricing')).toBe(
|
|
'#editor-generation-pricing',
|
|
);
|
|
});
|