zhou zhou
14 小时以前 0a1d91e42e6c5af96e1108e9ebcc37e99eb3b22c
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
import request from '@/utils/http'
 
export function buildAiParamPageParams(params = {}) {
  return {
    current: params.current || 1,
    pageSize: params.pageSize || params.size || 20,
    ...(params.condition !== undefined ? { condition: params.condition } : {}),
    ...(params.providerType !== undefined ? { providerType: params.providerType } : {}),
    ...(params.model !== undefined ? { model: params.model } : {}),
    ...(params.status !== undefined ? { status: params.status } : {})
  }
}
 
function normalizeManyIds(ids) {
  if (Array.isArray(ids)) {
    return ids
      .map((id) => String(id ?? '').trim())
      .filter(Boolean)
      .join(',')
  }
  return String(ids ?? '').trim()
}
 
function fetchAiParamPage(params = {}) {
  return request.post({ url: '/aiParam/page', params: buildAiParamPageParams(params) })
}
 
function fetchGetAiParamDetail(id) {
  return request.get({ url: `/aiParam/${id}` })
}
 
function fetchGetAiParamMany(ids) {
  return request.post({ url: `/aiParam/many/${normalizeManyIds(ids)}` })
}
 
function fetchSaveAiParam(params) {
  return request.post({ url: '/aiParam/save', params })
}
 
function fetchUpdateAiParam(params) {
  return request.post({ url: '/aiParam/update', params })
}
 
function fetchDeleteAiParam(id) {
  return request.post({ url: `/aiParam/remove/${id}` })
}
 
function fetchValidateAiParamDraft(params) {
  return request.post({ url: '/aiParam/validate-draft', params })
}
 
function fetchSetAiParamDefault(id) {
  return request.post({ url: `/aiParam/set-default/${id}` })
}
 
function fetchGetAiConfigSummary(promptCode) {
  return request.get({
    url: '/ai/config/summary',
    params: promptCode ? { promptCode } : {}
  })
}
 
async function fetchExportAiParamReport(payload = {}, options = {}) {
  return fetch(`${import.meta.env.VITE_API_URL}/aiParam/export`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      ...(options.headers || {})
    },
    body: JSON.stringify(payload)
  })
}
 
export function buildAiPromptPageParams(params = {}) {
  return {
    current: params.current || 1,
    pageSize: params.pageSize || params.size || 20,
    ...(params.condition !== undefined ? { condition: params.condition } : {}),
    ...(params.code !== undefined ? { code: params.code } : {}),
    ...(params.scene !== undefined ? { scene: params.scene } : {}),
    ...(params.status !== undefined ? { status: params.status } : {})
  }
}
 
function fetchAiPromptPage(params = {}) {
  return request.post({ url: '/aiPrompt/page', params: buildAiPromptPageParams(params) })
}
 
function fetchGetAiPromptDetail(id) {
  return request.get({ url: `/aiPrompt/${id}` })
}
 
function fetchSaveAiPrompt(params) {
  return request.post({ url: '/aiPrompt/save', params })
}
 
function fetchUpdateAiPrompt(params) {
  return request.post({ url: '/aiPrompt/update', params })
}
 
function fetchDeleteAiPrompt(id) {
  return request.post({ url: `/aiPrompt/remove/${id}` })
}
 
function fetchRenderAiPromptPreview(params) {
  return request.post({ url: '/aiPrompt/render-preview', params })
}
 
async function fetchExportAiPromptReport(payload = {}, options = {}) {
  return fetch(`${import.meta.env.VITE_API_URL}/aiPrompt/export`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      ...(options.headers || {})
    },
    body: JSON.stringify(payload)
  })
}
 
export function buildAiObservePageParams(params = {}) {
  return {
    current: params.current || 1,
    pageSize: params.pageSize || params.size || 20,
    ...(params.condition !== undefined ? { condition: params.condition } : {}),
    ...(params.requestId !== undefined ? { requestId: params.requestId } : {}),
    ...(params.promptCode !== undefined ? { promptCode: params.promptCode } : {}),
    ...(params.userId !== undefined ? { userId: params.userId } : {}),
    ...(params.status !== undefined ? { status: params.status } : {})
  }
}
 
function fetchAiCallLogPage(params = {}) {
  return request.post({ url: '/aiCallLog/page', params: buildAiObservePageParams(params) })
}
 
function fetchGetAiCallLogDetail(id) {
  return request.get({ url: `/aiCallLog/${id}` })
}
 
function fetchGetAiObserveStats() {
  return request.get({ url: '/aiCallLog/stats' })
}
 
function fetchGetAiCallLogMcpLogs(id) {
  return request.get({ url: `/aiCallLog/${id}/mcpLogs` })
}
 
export function buildAiMcpMountPageParams(params = {}) {
  return {
    current: params.current || 1,
    pageSize: params.pageSize || params.size || 20,
    ...(params.condition !== undefined ? { condition: params.condition } : {}),
    ...(params.transportType !== undefined ? { transportType: params.transportType } : {}),
    ...(params.status !== undefined ? { status: params.status } : {})
  }
}
 
function fetchAiMcpMountPage(params = {}) {
  return request.post({ url: '/aiMcpMount/page', params: buildAiMcpMountPageParams(params) })
}
 
function fetchGetAiMcpMountDetail(id) {
  return request.get({ url: `/aiMcpMount/${id}` })
}
 
function fetchSaveAiMcpMount(params) {
  return request.post({ url: '/aiMcpMount/save', params })
}
 
function fetchUpdateAiMcpMount(params) {
  return request.post({ url: '/aiMcpMount/update', params })
}
 
function fetchDeleteAiMcpMount(id) {
  return request.post({ url: `/aiMcpMount/remove/${id}` })
}
 
function fetchPreviewAiMcpTools(id) {
  return request.get({ url: `/aiMcpMount/${id}/tools` })
}
 
function fetchTestAiMcpConnectivity(id) {
  return request.post({ url: `/aiMcpMount/${id}/connectivity/test` })
}
 
function fetchValidateAiMcpDraftConnectivity(params) {
  return request.post({ url: '/aiMcpMount/connectivity/validate-draft', params })
}
 
function fetchTestAiMcpTool(id, params) {
  return request.post({ url: `/aiMcpMount/${id}/tool/test`, params })
}
 
export {
  fetchAiCallLogPage,
  fetchAiMcpMountPage,
  fetchAiParamPage,
  fetchAiPromptPage,
  fetchDeleteAiMcpMount,
  fetchDeleteAiParam,
  fetchDeleteAiPrompt,
  fetchExportAiParamReport,
  fetchExportAiPromptReport,
  fetchGetAiCallLogDetail,
  fetchGetAiCallLogMcpLogs,
  fetchGetAiConfigSummary,
  fetchGetAiMcpMountDetail,
  fetchGetAiObserveStats,
  fetchGetAiParamDetail,
  fetchGetAiParamMany,
  fetchGetAiPromptDetail,
  fetchPreviewAiMcpTools,
  fetchSaveAiMcpMount,
  fetchSaveAiParam,
  fetchRenderAiPromptPreview,
  fetchSaveAiPrompt,
  fetchSetAiParamDefault,
  fetchTestAiMcpConnectivity,
  fetchTestAiMcpTool,
  fetchUpdateAiMcpMount,
  fetchUpdateAiParam,
  fetchUpdateAiPrompt,
  fetchValidateAiMcpDraftConnectivity,
  fetchValidateAiParamDraft
}