fix(admin): Fix Prompt management list not showing version info and add debug diagnostics

Summary:
- Fix Prompt list API response schema missing activeVersion and draftVersion fields
- Fastify was filtering out undefined schema fields, causing version columns to show empty
- Add detailed diagnostic logging for Prompt debug mode troubleshooting
- Verify debug mode works correctly (DRAFT version is used when debug enabled)

Changes:
- backend/src/common/prompt/prompt.routes.ts: Add activeVersion and draftVersion to response schema
- backend/src/common/prompt/prompt.service.ts: Add diagnostic logs for setDebugMode and get methods
- PKB module: Various authentication and document handling fixes from previous session

Tested: Debug mode verified working - v2 DRAFT version correctly loaded when debug enabled
This commit is contained in:
2026-01-13 22:22:10 +08:00
parent 4088275290
commit 4ed67a8846
272 changed files with 1382 additions and 161 deletions

View File

@@ -7,6 +7,7 @@ import React, { useMemo } from 'react';
import { FileText, BookOpen, ExternalLink } from 'lucide-react';
import { ChatContainer } from '@/shared/components/Chat';
import type { KnowledgeBase, Document } from '../../api/knowledgeBaseApi';
import { getAccessToken } from '../../../../framework/auth/api';
interface DeepReadModeProps {
kbId: string;
@@ -144,16 +145,18 @@ export const DeepReadMode: React.FC<DeepReadModeProps> = ({
timestamp: Date.now(),
}]}
providerConfig={{
apiEndpoint: '/api/v1/chat/stream',
apiEndpoint: '/api/v2/pkb/chat/stream',
requestFn: async (message: string) => {
// 🔑 关键:传递 fullTextDocumentIds 而不是 documentIds
// fullTextDocumentIds 会触发全文加载模式AI可以看到完整文献
// documentIds 只是过滤RAG检索结果AI只能看到片段
const response = await fetch('/api/v1/chat/stream', {
const token = getAccessToken();
const response = await fetch('/api/v2/pkb/chat/stream', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'text/event-stream',
...(token ? { 'Authorization': `Bearer ${token}` } : {}),
},
body: JSON.stringify({
content: message,