feat:替换 Dify 为自建 RAG去实现

1、修复了若干无权限时的失败提示语
2、新增了一个生成后续建议问题的功能
3、重构了知识问答部分的权限管理模块
4、修复了若干渲染不恰当的样式渲染
This commit is contained in:
PingChuan
2026-04-10 16:20:32 +08:00
parent f525707358
commit 5bee9288b9
31 changed files with 407 additions and 304 deletions
+5
View File
@@ -159,6 +159,11 @@ export const difyClient = {
return { result: 'success' };
} catch (error: any) {
// 权限不足等明确错误需要抛出,不能吞掉
if (error.message?.includes('403') || error.message?.includes('401')) {
throw error;
}
// 网络超时等不确定错误才降级为成功(Dify 可能已执行删除)
console.warn('[Dify Chat] 删除会话请求失败,但可能已成功删除:', error.message);
return { result: 'success' };
}
+8 -3
View File
@@ -241,9 +241,14 @@ export async function deleteConversation(id: string): Promise<{ result: string }
* console.log('开场白:', opening_statement);
* ```
*/
export async function fetchAppParams(): Promise<AppParametersResponse> {
const url = `${API_URL}/parameters`;
console.log('⚙️ [Dify Client] 获取应用参数:', { url });
export async function fetchAppParams(appId?: string): Promise<AppParametersResponse> {
const params = new URLSearchParams();
if (appId) {
params.append('app_id', appId);
}
const url = params.toString() ? `${API_URL}/parameters?${params}` : `${API_URL}/parameters`;
console.log('⚙️ [Dify Client] 获取应用参数:', { url, appId });
try {
const response = await axios.get<AppParametersResponse>(url, {
+1
View File
@@ -365,6 +365,7 @@ export interface MessageEnd {
metadata?: {
annotation_reply?: any;
retriever_resources?: RetrieverResource[];
suggested_questions?: string[];
usage?: {
prompt_tokens: number;
completion_tokens: number;