feat(faq): 缓存高频问题及答案,命中直接返回预置答案,不走dify
This commit is contained in:
1 parent
3264ed1e07
commit
cf7cc11ffc
32 files changed
+3504
-180
No files matched your search
@@ -204,3 +204,40 @@ export const saveAdminQuickQuestion = (url: string, method: string, payload: Rec
|
||||
requestJson(url, { method, ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const deleteAdminQuickQuestion = (id: number) =>
|
||||
requestJson(`/api/admin/quick-questions/${id}`, { method: 'DELETE', ...auth() });
|
||||
|
||||
// Hot FAQ candidates (offline aggregation)
|
||||
export const listAdminFaqCandidates = (agentId?: number) => {
|
||||
const query = agentId ? `?agent_id=${agentId}` : '';
|
||||
return requestJson<any>(`/api/admin/faq-candidates${query}`, auth());
|
||||
};
|
||||
|
||||
export const refreshAdminFaqCandidates = (payload?: { agent_id?: number; dry_run?: boolean }) =>
|
||||
requestJson<{
|
||||
promoted_count?: number;
|
||||
scanned_logs?: number;
|
||||
enabled?: boolean;
|
||||
dry_run?: boolean;
|
||||
}>('/api/admin/faq-candidates/refresh', {
|
||||
method: 'POST',
|
||||
...jsonAuth(),
|
||||
body: JSON.stringify(payload || {}),
|
||||
});
|
||||
|
||||
export const promoteAdminFaqCandidate = (payload: {
|
||||
agent_id: number;
|
||||
q_norm: string;
|
||||
title?: string;
|
||||
sort_order?: number;
|
||||
}) =>
|
||||
requestJson('/api/admin/faq-candidates/promote', {
|
||||
method: 'POST',
|
||||
...jsonAuth(),
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
|
||||
export const dismissAdminFaqCandidate = (payload: { agent_id: number; q_norm: string }) =>
|
||||
requestJson('/api/admin/faq-candidates/dismiss', {
|
||||
method: 'POST',
|
||||
...jsonAuth(),
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
Reference in new issue
Block a user