docs & cleanup: update stack info, remove dead code, fix backend bugs

- Fix AGENTS.md and 技术架构设计.md to reflect actual stack (Prisma+MySQL, static export, PM2)
- Remove 4 unused frontend components (page-transition, page-layout, image-upload, section-card)
- Fix card.tsx hardcoded colors → CSS variables
- Remove provider name from model selector, remove sensenova-u1-fast from models
- Fix analytics.controller.ts raw SQL table names (runtime bug)
- Add JWT auth guard to tools POST endpoint
- Fix AI gateway test: update env vars and model names
- Fix admin test: mock role structure for Prisma relation
This commit is contained in:
yuzhiran-dev
2026-05-29 10:26:50 +08:00
parent 417fb266d4
commit 6f3fe50ee0
15 changed files with 118 additions and 304 deletions
@@ -6,8 +6,8 @@ describe('AIGatewayService', () => {
beforeEach(async () => {
// Clear env before each test
delete process.env.DEEPSEEK_API_KEY;
delete process.env.DASHSCOPE_API_KEY;
delete process.env.OPENAI_API_KEY;
delete process.env.SENSENOVA_API_KEY;
const module: TestingModule = await Test.createTestingModule({
providers: [AIGatewayService],
@@ -70,8 +70,8 @@ describe('AIGatewayService', () => {
});
describe('model routing', () => {
it('should route deepseek models to deepseek provider (but fallback to mock)', async () => {
const result = await service.chat('deepseek-chat', [
it('should route deepseek-v4-flash to its provider (but fallback to mock)', async () => {
const result = await service.chat('deepseek-v4-flash', [
{ role: 'user', content: '你好' },
]);
@@ -79,8 +79,8 @@ describe('AIGatewayService', () => {
expect(result).toContain('宇之然 AI 助手');
});
it('should route qwen models to dashscope provider (but fallback to mock)', async () => {
const result = await service.chat('qwen-max', [
it('should route general model to openai provider (but fallback to mock)', async () => {
const result = await service.chat('general', [
{ role: 'user', content: '你好' },
]);