智能分析(异步mq)
This commit is contained in:
parent
683cc1ec74
commit
f6051ec7c1
@ -1,4 +1,4 @@
|
|||||||
import { genChartByAiAsyncUsingPOST } from '@/services/answerbi/chartController';
|
import { genChartByAiAsyncMqUsingPOST } from '@/services/answerbi/chartController';
|
||||||
import { UploadOutlined } from '@ant-design/icons';
|
import { UploadOutlined } from '@ant-design/icons';
|
||||||
import { Button, Card, Form, Input, Select, Space, Upload, message } from 'antd';
|
import { Button, Card, Form, Input, Select, Space, Upload, message } from 'antd';
|
||||||
import { useForm } from 'antd/es/form/Form';
|
import { useForm } from 'antd/es/form/Form';
|
||||||
@ -22,7 +22,7 @@ const AddChartAsync: React.FC = () => {
|
|||||||
};
|
};
|
||||||
try{
|
try{
|
||||||
//需要取到上传的原始数据 file->file->originFileObj
|
//需要取到上传的原始数据 file->file->originFileObj
|
||||||
const res = await genChartByAiAsyncUsingPOST(params, {}, values.file.file.originFileObj);
|
const res = await genChartByAiAsyncMqUsingPOST(params, {}, values.file.file.originFileObj);
|
||||||
//正常情况下,如果没有返回值就分析失败,有就分析成功
|
//正常情况下,如果没有返回值就分析失败,有就分析成功
|
||||||
if(!res?.data){
|
if(!res?.data){
|
||||||
message.error('分析失败');
|
message.error('分析失败');
|
||||||
|
|||||||
@ -119,6 +119,42 @@ export async function genChartByAiAsyncUsingPOST(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** genChartByAiAsyncMq POST /api/chart/gen/async/mq */
|
||||||
|
export async function genChartByAiAsyncMqUsingPOST(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: API.genChartByAiAsyncMqUsingPOSTParams,
|
||||||
|
body: {},
|
||||||
|
file?: File,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
const formData = new FormData();
|
||||||
|
|
||||||
|
if (file) {
|
||||||
|
formData.append('file', file);
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.keys(body).forEach((ele) => {
|
||||||
|
const item = (body as any)[ele];
|
||||||
|
|
||||||
|
if (item !== undefined && item !== null) {
|
||||||
|
formData.append(
|
||||||
|
ele,
|
||||||
|
typeof item === 'object' && !(item instanceof File) ? JSON.stringify(item) : item,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return request<API.CommonResponseBiResponse_>('/api/chart/gen/async/mq', {
|
||||||
|
method: 'POST',
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
},
|
||||||
|
data: formData,
|
||||||
|
requestType: 'form',
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/** getChartById GET /api/chart/get */
|
/** getChartById GET /api/chart/get */
|
||||||
export async function getChartByIdUsingGET(
|
export async function getChartByIdUsingGET(
|
||||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
|||||||
6
src/services/answerbi/typings.d.ts
vendored
6
src/services/answerbi/typings.d.ts
vendored
@ -149,6 +149,12 @@ declare namespace API {
|
|||||||
id?: number;
|
id?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type genChartByAiAsyncMqUsingPOSTParams = {
|
||||||
|
chartName?: string;
|
||||||
|
chartType?: string;
|
||||||
|
goal?: string;
|
||||||
|
};
|
||||||
|
|
||||||
type genChartByAiAsyncUsingPOSTParams = {
|
type genChartByAiAsyncUsingPOSTParams = {
|
||||||
chartName?: string;
|
chartName?: string;
|
||||||
chartType?: string;
|
chartType?: string;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user