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
|
}
|