497 lines
20 KiB
TypeScript
497 lines
20 KiB
TypeScript
/**
|
|
* features/admin/api/admin.api.ts
|
|
* 管理后台 HTTP API:用户、部门、Agent、权限、报表、企业微信、公告、关联服务等。
|
|
*/
|
|
import { getAuthHeaders } from '@/shared/utils/auth';
|
|
import { requestJson } from '@/shared/api/client';
|
|
import type { AdminUserRow } from '../types/admin.types';
|
|
import type { AdminDashboardSummary } from '../types/dashboard.types';
|
|
import type { PaginatedResult } from '@/shared/types/pagination.types';
|
|
import type { AdminLinkedServiceRow } from '../types/linked-service.types';
|
|
import type {
|
|
ApplicationReport,
|
|
ApplicationSortKey,
|
|
ApplicationStatusFilter,
|
|
ApplicationUsageFilter,
|
|
OpsOverviewReport,
|
|
UsageReport,
|
|
UsageRangeKey,
|
|
} from '../types/report.types';
|
|
|
|
const auth = () => ({ headers: getAuthHeaders() });
|
|
const jsonAuth = () => ({ headers: { 'Content-Type': 'application/json', ...getAuthHeaders() } });
|
|
|
|
// Users
|
|
export const listAdminUsers = () => requestJson<AdminUserRow[]>('/api/admin/users', auth());
|
|
|
|
export interface ListAdminUsersPageParams {
|
|
page?: number;
|
|
pageSize?: number;
|
|
username?: string;
|
|
email?: string;
|
|
department?: string;
|
|
role?: string;
|
|
status?: string;
|
|
real_name?: string;
|
|
employee_id?: string;
|
|
phone_number?: string;
|
|
hideRejected?: boolean;
|
|
/** 排序列:username | department */
|
|
sortBy?: 'username' | 'department';
|
|
/** 排序方向 */
|
|
sortDir?: 'asc' | 'desc';
|
|
}
|
|
|
|
/**
|
|
* 分页拉取用户列表(服务端筛选 + 分页 + 排序,供用户管理页使用)。
|
|
* @param params - 页码、每页条数、字段模糊筛选与 sortBy/sortDir
|
|
*/
|
|
export const listAdminUsersPage = (params: ListAdminUsersPageParams) => {
|
|
const qs = new URLSearchParams();
|
|
qs.set('page', String(params.page ?? 1));
|
|
qs.set('page_size', String(params.pageSize ?? 20));
|
|
const textFilters: Array<{ paramKey: keyof ListAdminUsersPageParams; queryKey: string }> = [
|
|
{ paramKey: 'username', queryKey: 'username' },
|
|
{ paramKey: 'email', queryKey: 'email' },
|
|
{ paramKey: 'department', queryKey: 'department' },
|
|
{ paramKey: 'role', queryKey: 'role' },
|
|
{ paramKey: 'status', queryKey: 'status' },
|
|
{ paramKey: 'real_name', queryKey: 'real_name' },
|
|
{ paramKey: 'employee_id', queryKey: 'employee_id' },
|
|
{ paramKey: 'phone_number', queryKey: 'phone_number' },
|
|
];
|
|
for (const { paramKey, queryKey } of textFilters) {
|
|
const raw = params[paramKey];
|
|
const value = typeof raw === 'string' ? raw.trim() : '';
|
|
if (value) qs.set(queryKey, value);
|
|
}
|
|
if (params.hideRejected) qs.set('hide_rejected', 'true');
|
|
if (params.sortBy) qs.set('sort_by', params.sortBy);
|
|
if (params.sortDir) qs.set('sort_dir', params.sortDir);
|
|
return requestJson<PaginatedResult<AdminUserRow>>(`/api/admin/users?${qs.toString()}`, auth());
|
|
};
|
|
export const createAdminUser = (payload: Record<string, unknown>) =>
|
|
requestJson('/api/admin/users', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
|
export const updateAdminUser = (id: number, payload: Record<string, unknown>) =>
|
|
requestJson(`/api/admin/users/${id}`, { method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload) });
|
|
export const approveAdminUser = (id: number) =>
|
|
requestJson(`/api/admin/users/${id}/approve`, { method: 'POST', ...auth() });
|
|
export const rejectAdminUser = (id: number) =>
|
|
requestJson(`/api/admin/users/${id}/reject`, { method: 'POST', ...auth() });
|
|
export const cleanupRejectedAdminUsers = () =>
|
|
requestJson<{ deleted_count: number }>('/api/admin/users/cleanup-rejected', { method: 'POST', ...auth() });
|
|
export const batchDeleteAdminUsers = (userIds: number[]) =>
|
|
requestJson<{ deleted_count: number }>('/api/admin/users/batch-delete', {
|
|
method: 'POST',
|
|
...jsonAuth(),
|
|
body: JSON.stringify({ user_ids: userIds }),
|
|
});
|
|
export const batchUpdateAdminUsers = (userIds: number[], data: Record<string, unknown>) =>
|
|
requestJson('/api/admin/users/batch', {
|
|
method: 'PUT',
|
|
...jsonAuth(),
|
|
body: JSON.stringify({ user_ids: userIds, data }),
|
|
});
|
|
export const updateAdminUserPermissions = (userId: number, agentIds: number[]) =>
|
|
requestJson(`/api/admin/users/${userId}/permissions`, {
|
|
method: 'POST',
|
|
...jsonAuth(),
|
|
body: JSON.stringify({ agent_ids: agentIds }),
|
|
});
|
|
|
|
// Departments
|
|
export const listAdminDepartments = () => requestJson<any[]>('/api/admin/departments', auth());
|
|
export const listAdminDepartmentMembers = (id: number) =>
|
|
requestJson(`/api/admin/departments/${id}/members`, auth());
|
|
export const createAdminDepartment = (payload: Record<string, unknown>) =>
|
|
requestJson('/api/admin/departments', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
|
export const updateAdminDepartment = (id: number, payload: Record<string, unknown>) =>
|
|
requestJson(`/api/admin/departments/${id}`, { method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload) });
|
|
export const deleteAdminDepartment = (id: number) =>
|
|
requestJson(`/api/admin/departments/${id}`, { method: 'DELETE', ...auth() });
|
|
|
|
// Agents
|
|
export interface AdminAgentRegistrySchema {
|
|
platform: {
|
|
runtime_providers: string[];
|
|
conversation_modes: string[];
|
|
dify_app_types: string[];
|
|
suggested_questions_styles: string[];
|
|
default_capabilities: Record<string, boolean>;
|
|
tool_run_progress_defaults: {
|
|
progress_type?: string;
|
|
poll_interval_seconds?: number;
|
|
lock_input_when_running?: boolean;
|
|
};
|
|
};
|
|
agent_types: Array<{
|
|
agent_code: string;
|
|
label: string;
|
|
conversation_mode_default: string;
|
|
runtime_provider_default: string;
|
|
runtime_handler?: string | null;
|
|
models?: string[];
|
|
required_fields?: string[];
|
|
forced_capabilities?: Record<string, boolean>;
|
|
default_capabilities?: Record<string, boolean>;
|
|
default_intent_routes?: string[];
|
|
progress_contract?: Record<string, unknown> | null;
|
|
handler_config_schema?: Record<string, unknown>;
|
|
}>;
|
|
handler_config_schemas: Record<string, unknown>;
|
|
content_profile_keys: string[];
|
|
}
|
|
|
|
export const getAdminAgentRegistrySchema = () =>
|
|
requestJson<AdminAgentRegistrySchema>('/api/admin/agents/schema', auth());
|
|
|
|
export const inferAdminContentProfile = (intentRoutes: string[]) =>
|
|
requestJson<{ content_profile: string | null }>('/api/admin/agents/infer-content-profile', {
|
|
method: 'POST',
|
|
...jsonAuth(),
|
|
body: JSON.stringify({ intent_routes: intentRoutes }),
|
|
});
|
|
|
|
export const listAdminAgentTypeCatalog = () =>
|
|
getAdminAgentRegistrySchema().then((schema) => schema.agent_types);
|
|
|
|
export interface AdminIntentRouteOption {
|
|
key: string;
|
|
label: string;
|
|
description?: string;
|
|
category?: string;
|
|
enabled?: boolean;
|
|
sort_order?: number;
|
|
}
|
|
|
|
export const listAdminIntentRoutes = () =>
|
|
requestJson<AdminIntentRouteOption[]>('/api/admin/agents/intent-routes', auth());
|
|
|
|
export interface AdminContentProfileOption {
|
|
key: string;
|
|
label: string;
|
|
description?: string;
|
|
welcome_message?: string;
|
|
suggested_questions_style?: 'plain' | 'styled';
|
|
suggested_questions?: Array<{ question: string; group?: string }>;
|
|
}
|
|
|
|
export const listAdminContentProfiles = () =>
|
|
requestJson<AdminContentProfileOption[]>('/api/admin/agents/content-profiles', auth());
|
|
|
|
export const listAdminAgents = () => requestJson<any[]>('/api/admin/agents', auth());
|
|
export const createAdminAgent = (payload: Record<string, unknown>) =>
|
|
requestJson('/api/admin/agents', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
|
export const updateAdminAgent = (id: number, payload: Record<string, unknown>) =>
|
|
requestJson(`/api/admin/agents/${id}`, { method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload) });
|
|
export const deleteAdminAgent = (id: number) =>
|
|
requestJson(`/api/admin/agents/${id}`, { method: 'DELETE', ...auth() });
|
|
|
|
// Agent Guides
|
|
export const listAdminAgentGuides = (agentId?: number) => {
|
|
const url = agentId ? `/api/admin/guides?agent_id=${agentId}` : '/api/admin/guides';
|
|
return requestJson<any[]>(url, auth());
|
|
};
|
|
|
|
export const createAdminAgentGuide = (payload: Record<string, unknown>) =>
|
|
requestJson('/api/admin/guides', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
|
|
|
export const updateAdminAgentGuide = (id: number, payload: Record<string, unknown>) =>
|
|
requestJson(`/api/admin/guides/${id}`, { method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload) });
|
|
|
|
export const deleteAdminAgentGuide = (id: number) =>
|
|
requestJson(`/api/admin/guides/${id}`, { method: 'DELETE', ...auth() });
|
|
|
|
export const uploadAdminAgentGuideFile = async (file: File) => {
|
|
const formData = new FormData();
|
|
formData.append('file', file);
|
|
const response = await fetch('/api/admin/guides/upload', {
|
|
method: 'POST',
|
|
headers: getAuthHeaders(),
|
|
body: formData,
|
|
});
|
|
if (!response.ok) {
|
|
const error = await response.json().catch(() => ({}));
|
|
throw new Error(error.message || 'Upload failed');
|
|
}
|
|
return response.json();
|
|
};
|
|
export const importAdminAgentTrainingQuestionBankFromPdf = (agentId: number, payload: { guide_id?: number | null }) =>
|
|
requestJson<{
|
|
guide_id: number;
|
|
guide_file_name: string;
|
|
parsed_count: number;
|
|
skipped_question_numbers: number[];
|
|
extraction_mode?: 'pdf_text' | 'ocr' | 'ocr_fallback';
|
|
extraction_warnings?: string[];
|
|
question_bank: Array<{
|
|
id: string;
|
|
type: 'single' | 'boolean';
|
|
prompt: string;
|
|
answer: string;
|
|
explanation: string;
|
|
options?: Array<{ id: string; label: string }>;
|
|
}>;
|
|
}>(`/api/admin/agents/${agentId}/training-question-bank/import-pdf`, {
|
|
method: 'POST',
|
|
...jsonAuth(),
|
|
body: JSON.stringify(payload),
|
|
});
|
|
export const testAdminAgent = (id: number) =>
|
|
requestJson<any>(`/api/admin/agents/${id}/test`, { method: 'POST', ...auth() });
|
|
export const saveAdminAgentPermissions = (agentId: number, userIds: number[]) =>
|
|
requestJson(`/api/admin/agents/${agentId}/permissions`, {
|
|
method: 'POST',
|
|
...jsonAuth(),
|
|
body: JSON.stringify({ user_ids: userIds }),
|
|
});
|
|
|
|
export const batchUpdateAdminPermissions = (payload: Record<string, unknown>) =>
|
|
requestJson('/api/admin/permissions/batch', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
|
export const importAdminPermissions = (formData: FormData) =>
|
|
requestJson('/api/admin/permissions/import', { method: 'POST', ...auth(), body: formData });
|
|
|
|
// Dashboard
|
|
/** 仪表盘四张卡片:Agent 数、用户数、对话总数、平均评分 */
|
|
export const getAdminDashboardSummary = () =>
|
|
requestJson<AdminDashboardSummary>('/api/admin/dashboard/summary', auth());
|
|
|
|
// Reports
|
|
export interface AdminUsageReportParams {
|
|
user_page?: number;
|
|
user_page_size?: number;
|
|
/** 时间范围:7d | 30d | 90d | 180d | 365d */
|
|
range?: UsageRangeKey;
|
|
}
|
|
|
|
export const getAdminUsageReport = (params: AdminUsageReportParams = {}) => {
|
|
const qs = new URLSearchParams();
|
|
if (params.user_page != null) qs.set('user_page', String(params.user_page));
|
|
if (params.user_page_size != null) qs.set('user_page_size', String(params.user_page_size));
|
|
if (params.range) qs.set('range', params.range);
|
|
const query = qs.toString();
|
|
return requestJson<UsageReport>(
|
|
`/api/admin/reports/usage${query ? `?${query}` : ''}`,
|
|
auth(),
|
|
);
|
|
};
|
|
|
|
export interface AdminApplicationReportParams {
|
|
range?: UsageRangeKey;
|
|
status?: ApplicationStatusFilter;
|
|
usage?: ApplicationUsageFilter;
|
|
q?: string;
|
|
sort?: ApplicationSortKey;
|
|
order?: 'asc' | 'desc';
|
|
page?: number;
|
|
page_size?: number;
|
|
}
|
|
|
|
/**
|
|
* 拉取应用运营报表(按应用聚合使用 / 权限 / 评分)。
|
|
* @param params - 时间范围、状态、使用筛选、搜索与排序分页
|
|
*/
|
|
export const getAdminApplicationReport = (params: AdminApplicationReportParams = {}) => {
|
|
const qs = new URLSearchParams();
|
|
if (params.range) qs.set('range', params.range);
|
|
if (params.status && params.status !== 'all') qs.set('status', params.status);
|
|
if (params.usage && params.usage !== 'all') qs.set('usage', params.usage);
|
|
if (params.q?.trim()) qs.set('q', params.q.trim());
|
|
if (params.sort) qs.set('sort', params.sort);
|
|
if (params.order) qs.set('order', params.order);
|
|
if (params.page != null) qs.set('page', String(params.page));
|
|
if (params.page_size != null) qs.set('page_size', String(params.page_size));
|
|
const query = qs.toString();
|
|
return requestJson<ApplicationReport>(
|
|
`/api/admin/reports/applications${query ? `?${query}` : ''}`,
|
|
auth(),
|
|
);
|
|
};
|
|
|
|
export const getAdminFeedbackReport = () => requestJson<any>('/api/admin/reports/feedback', auth());
|
|
|
|
/**
|
|
* 拉取运营总览报表:对话量 / 活跃用户 / 活跃应用 / 好评率 / 趋势环比 / Top 与低使用应用 / 低评分回答 / 未处理反馈。
|
|
* @param params - 时间范围(近 7/30/90 天)
|
|
*/
|
|
export const getAdminOpsOverview = (params: { range?: UsageRangeKey } = {}) => {
|
|
const qs = new URLSearchParams();
|
|
if (params.range) qs.set('range', params.range);
|
|
const query = qs.toString();
|
|
return requestJson<OpsOverviewReport>(
|
|
`/api/admin/reports/overview${query ? `?${query}` : ''}`,
|
|
auth(),
|
|
);
|
|
};
|
|
|
|
export const getAdminReportTable = (url: string) => requestJson<any[]>(url, auth());
|
|
export const getAdminReportTableCount = (url: string) => requestJson<{ total: number }>(url, auth());
|
|
|
|
/**
|
|
* 拉取聊天日志「Top 提问内容 / Top 回答内容」(直接按 ChatLog 明细统计)。
|
|
* @param query - 可选的查询串(时间范围/应用/用户等识别条件)
|
|
*/
|
|
export const getAdminChatLogTops = (query = '') =>
|
|
requestJson<{ questions: Array<{ label: string; count: number }>; answers: Array<{ label: string; count: number }> }>(
|
|
`/api/admin/reports/chat-log-tops${query}`,
|
|
auth(),
|
|
);
|
|
|
|
/** 反馈概览:待处理 / 本月已关闭 / 最多反馈应用 */
|
|
export const getAdminFeedbackSummary = (query = '') =>
|
|
requestJson<{ pending_count: number; closed_this_month: number; top_app: { name: string; count: number } }>(
|
|
`/api/admin/reports/feedback-summary${query}`,
|
|
auth(),
|
|
);
|
|
|
|
/** 问题分析:高频问题簇 KPI + 优先处理问题(复用聊天日志风险规则) */
|
|
export const getAdminIssueAnalysis = (query = '') =>
|
|
requestJson<{
|
|
kpi: {
|
|
high_freq_clusters: number;
|
|
attention_signals: number;
|
|
review_signals: number;
|
|
empty_answers: number;
|
|
top10_ratio: number;
|
|
top_risk_app: { name: string; signal_count: number; attention_ratio: number };
|
|
};
|
|
total_questions: number;
|
|
questions: Array<{ topic: string; count: number; apps: string; attention_count: number; reasons: string[]; checks: string[] }>;
|
|
}>(`/api/admin/reports/issue-analysis${query}`, auth());
|
|
|
|
/** 将一条意见反馈标记为已关闭 */
|
|
export const closeAdminGeneralFeedback = (feedbackId: number) =>
|
|
requestJson<{ id: number; status: string; closed_at: string }>(
|
|
`/api/admin/reports/general-feedbacks/${feedbackId}/close`,
|
|
{ method: 'POST', ...auth() },
|
|
);
|
|
export const batchDeleteAdminChatLogs = (ids: number[]) =>
|
|
requestJson<{ deleted_count: number }>('/api/admin/database/chat_logs/batch-delete', {
|
|
method: 'POST',
|
|
...jsonAuth(),
|
|
body: JSON.stringify({ ids }),
|
|
});
|
|
|
|
// WeCom admin
|
|
export interface ListAdminWecomBindingsParams {
|
|
boundOnly?: boolean;
|
|
keyword?: string;
|
|
page?: number;
|
|
pageSize?: number;
|
|
}
|
|
|
|
export const listAdminWecomBindings = (params: ListAdminWecomBindingsParams = {}) => {
|
|
const qs = new URLSearchParams();
|
|
if (params.boundOnly) qs.set('bound_only', 'true');
|
|
const keyword = params.keyword?.trim();
|
|
if (keyword) qs.set('keyword', keyword);
|
|
if (params.page) qs.set('page', String(params.page));
|
|
if (params.pageSize) qs.set('page_size', String(params.pageSize));
|
|
const query = qs.toString();
|
|
const suffix = query ? `?${query}` : '';
|
|
return requestJson<import('@/shared/types/pagination.types').PaginatedResult<
|
|
import('@/features/admin/types/wecom.types').WecomBindingRow
|
|
>>(`/api/admin/wecom/bindings${suffix}`, auth());
|
|
};
|
|
export const listAdminWecomLoginAudits = (query: string) =>
|
|
requestJson<any[]>(`/api/admin/wecom/login-audits?${query}`, auth());
|
|
export const getAdminWecomSystemSettings = () =>
|
|
requestJson<any>('/api/admin/wecom/system-settings', auth());
|
|
export const getAdminWecomIntegrationManifest = () =>
|
|
requestJson<any>('/api/admin/wecom/integration-manifest', auth());
|
|
export const saveAdminWecomSystemSettings = (payload: Record<string, unknown>) =>
|
|
requestJson<any>('/api/admin/wecom/system-settings', {
|
|
method: 'PUT',
|
|
...jsonAuth(),
|
|
body: JSON.stringify(payload),
|
|
});
|
|
export const getAdminWecomNotifySettings = () =>
|
|
requestJson<any>('/api/admin/wecom/notify-settings', auth());
|
|
export const saveAdminWecomNotifySettings = (payload: Record<string, unknown>) =>
|
|
requestJson<any>('/api/admin/wecom/notify-settings', {
|
|
method: 'PUT',
|
|
...jsonAuth(),
|
|
body: JSON.stringify(payload),
|
|
});
|
|
export const getAdminWecomNotifyMetrics = () =>
|
|
requestJson<any>('/api/admin/wecom/notify-metrics', auth());
|
|
export const getAdminWecomBindingStats = () =>
|
|
requestJson<import('@/features/admin/types/wecom.types').WecomBindingStats>('/api/admin/wecom/binding-stats', auth());
|
|
export const syncAdminWecomUserids = (payload: { apply: boolean }) =>
|
|
requestJson<import('@/features/admin/types/wecom.types').WecomSyncSummary>('/api/admin/wecom/sync-userids', {
|
|
method: 'POST',
|
|
...jsonAuth(),
|
|
body: JSON.stringify(payload),
|
|
});
|
|
export const bindAdminWecomUser = (payload: Record<string, unknown>) =>
|
|
requestJson('/api/admin/wecom/bind', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
|
export const unbindAdminWecomUser = (userId: number) =>
|
|
requestJson('/api/admin/wecom/unbind', {
|
|
method: 'POST',
|
|
...jsonAuth(),
|
|
body: JSON.stringify({ user_id: userId }),
|
|
});
|
|
|
|
// Announcements
|
|
export const listAnnouncements = () => requestJson<any[]>('/api/admin/announcements', auth());
|
|
export const createAnnouncement = (payload: Record<string, unknown>) =>
|
|
requestJson('/api/admin/announcements', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
|
export const updateAnnouncement = (id: number, payload: Record<string, unknown>) =>
|
|
requestJson(`/api/admin/announcements/${id}`, { method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload) });
|
|
export const deleteAnnouncement = (id: number) =>
|
|
requestJson(`/api/admin/announcements/${id}`, { method: 'DELETE', ...auth() });
|
|
|
|
// Linked services(关联服务:侧栏跳转入口)
|
|
export const listLinkedServices = () =>
|
|
requestJson<AdminLinkedServiceRow[]>('/api/admin/linked-services', auth());
|
|
export const createLinkedService = (payload: Record<string, unknown>) =>
|
|
requestJson('/api/admin/linked-services', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
|
export const updateLinkedService = (id: number, payload: Record<string, unknown>) =>
|
|
requestJson(`/api/admin/linked-services/${id}`, { method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload) });
|
|
export const deleteLinkedService = (id: number) =>
|
|
requestJson(`/api/admin/linked-services/${id}`, { method: 'DELETE', ...auth() });
|
|
|
|
// Quick questions
|
|
export const listAdminQuickQuestions = () => requestJson<any[]>('/api/admin/quick-questions', auth());
|
|
export const saveAdminQuickQuestion = (url: string, method: string, payload: Record<string, unknown>) =>
|
|
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),
|
|
});
|