officialSiteAgentDisplay.ts
3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import { apiClient } from './client';
export type DisplayStatus = 'enable' | 'disable';
export type MediaType = 'jpg' | 'jpeg' | 'png' | 'webp' | 'gif' | 'mp4' | 'mov' | 'avi' | 'webm';
export type AgentStatus = 'enable' | 'disable';
export type OfficialSiteUploadUsageType = 'agent_media' | 'agent_icon' | 'methodology_icon' | 'methodology_image';
export interface OfficialSiteAvailableAgent extends Record<string, unknown> {
display_id: number;
agent_id: number;
agent_name: string;
agent_code: string;
is_configured: boolean;
configured_description?: string;
is_steward: boolean;
icon_url?: string;
media_url?: string;
media_type?: MediaType;
summary?: string;
speech_content?: string;
display_status: DisplayStatus;
agent_status: AgentStatus;
}
export interface OfficialSiteStewardAgentNote {
agent_id: number;
agent_name: string;
note: string;
}
export interface OfficialSiteAvailableAgentsResponse {
tab_id: number;
position_name: string;
qrcode_id: number;
available_agents: OfficialSiteAvailableAgent[];
steward_agent?: OfficialSiteStewardAgentNote;
}
export interface SaveOfficialAgentDisplayPayload {
media_url: string;
media_type: MediaType;
media_size: number;
speech_title: string;
speech_content: string;
display_status: DisplayStatus;
sort_order: number;
icon_url: string;
summary?: string;
}
export interface SaveOfficialAgentDisplayResponse {
media_url: string;
media_type: MediaType;
media_size: number;
speech_title: string;
speech_content: string;
display_status: DisplayStatus;
sort_order: number;
}
export interface DeleteOfficialAgentDisplayResponse {
success: boolean;
deleted_at: string;
}
export interface UploadOfficialSiteAssetResponse {
file_id: string;
file_url: string;
file_type: MediaType;
file_size: number;
extracted_text?: string;
session_id?: string;
}
export async function getAvailableAgents(tabId: number): Promise<OfficialSiteAvailableAgentsResponse> {
return apiClient.get<OfficialSiteAvailableAgentsResponse>(`/official-site/tabs/${tabId}/agents/available`);
}
export interface OfficialSiteAgentDisplayDetail {
display_id: number;
agent_id: number;
agent_name: string;
agent_code: string;
media_url?: string;
media_type?: MediaType;
media_size: number;
icon_url?: string;
speech_title?: string;
speech_content?: string;
summary?: string;
sort_order: number;
display_status: DisplayStatus;
agent_status: AgentStatus;
}
export async function getAgentDisplayDetail(displayId: number): Promise<OfficialSiteAgentDisplayDetail> {
return apiClient.get<OfficialSiteAgentDisplayDetail>(`/official-site/agent-displays/${displayId}`);
}
export async function updateAgentDisplayConfig(displayId: number, payload: SaveOfficialAgentDisplayPayload): Promise<SaveOfficialAgentDisplayResponse> {
return apiClient.post<SaveOfficialAgentDisplayResponse>(`/official-site/agent-displays/${displayId}/config`, payload);
}
export async function uploadOfficialSiteAsset(formData: FormData): Promise<UploadOfficialSiteAssetResponse> {
return apiClient.post<UploadOfficialSiteAssetResponse>('/official-site/upload', formData);
}