添加ai请求地址
This commit is contained in:
+18
-7
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
/** ai-server 统一响应 */
|
||||
import { request } from '../request/ai';
|
||||
interface AiResp<T = any> {
|
||||
code: number;
|
||||
message: string;
|
||||
@@ -16,9 +17,7 @@ interface AiResp<T = any> {
|
||||
|
||||
export class AiError extends Error {
|
||||
code: number;
|
||||
|
||||
data: any;
|
||||
|
||||
constructor(code: number, message: string, data?: any) {
|
||||
super(message || `AI 服务错误(${code})`);
|
||||
this.code = code;
|
||||
@@ -182,12 +181,24 @@ export interface RecognizeResult {
|
||||
materials_suggest: string[];
|
||||
}
|
||||
|
||||
export const aiRecognize = (content: string, deviceTags: string[] = []) =>
|
||||
aiFetch<RecognizeResult>('/open/v1/moc/change/recognize', {
|
||||
request_id: nextRequestId('rec'),
|
||||
content,
|
||||
device_tags: deviceTags
|
||||
export function aiRecognize(content: string, deviceTags: string[] = []){
|
||||
return request({
|
||||
url: '/open/v1/moc/change/recognize',
|
||||
method: 'get',
|
||||
params: {
|
||||
request_id: nextRequestId('rec'),
|
||||
content,
|
||||
device_tags: deviceTags
|
||||
}
|
||||
});
|
||||
}
|
||||
// aiFetch<RecognizeResult>('/open/v1/moc/change/recognize', {
|
||||
// request_id: nextRequestId('rec'),
|
||||
// content,
|
||||
// device_tags: deviceTags
|
||||
// });
|
||||
|
||||
|
||||
|
||||
export interface ApplicationResult {
|
||||
name: string;
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import { request } from '../request';
|
||||
|
||||
/** 变更预识别查询
|
||||
*
|
||||
*/
|
||||
export function precheckApi(id: number) {
|
||||
return request({
|
||||
url: `/api/changes/${id}/precheck`,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 变更预识别保存
|
||||
*
|
||||
*/
|
||||
export function precheckSaveApi(params: {
|
||||
change_id: number,
|
||||
title: string,
|
||||
description: string,
|
||||
severity: string,
|
||||
probability: string,
|
||||
protection: string,
|
||||
compare_rows: {item: string, before_text: string, after_text: string}[]
|
||||
}) {
|
||||
return request({
|
||||
url: '/api/changes/precheck',
|
||||
method: 'post',
|
||||
data: params
|
||||
});
|
||||
}
|
||||
|
||||
/** 变更申请表查询
|
||||
*
|
||||
*/
|
||||
export function applicationApi(id: number) {
|
||||
return request({
|
||||
url: `/api/changes/${id}/apply-form`,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 变更申请表保存
|
||||
*
|
||||
*/
|
||||
export function applicationSaveApi(id: number, params: {
|
||||
change_type: number,
|
||||
change_level: number,
|
||||
duration_type: number,
|
||||
restore_deadline: string,
|
||||
org_id: number,
|
||||
urgent: number,
|
||||
purposes: string[],
|
||||
effect: string,
|
||||
main_changes: string[],
|
||||
related_changes: string[],
|
||||
materials: string,
|
||||
update_docs: string[],
|
||||
disciplines: string[],
|
||||
manage_dept: string,
|
||||
plan_use_date: string,
|
||||
risk_tools: string[],
|
||||
}) {
|
||||
return request({
|
||||
url: `/api/changes/${id}/apply-form`,
|
||||
method: 'post',
|
||||
data: params
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user