解决跨域问题
This commit is contained in:
+1
-11
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
|
||||
/** ai-server 统一响应 */
|
||||
import { request } from '../request/ai';
|
||||
interface AiResp<T = any> {
|
||||
code: number;
|
||||
message: string;
|
||||
@@ -182,21 +181,12 @@ export interface RecognizeResult {
|
||||
}
|
||||
|
||||
export function aiRecognize(content: string, deviceTags: string[] = []) {
|
||||
return request({
|
||||
url: '/open/v1/moc/change/recognize',
|
||||
method: 'post',
|
||||
params: {
|
||||
return aiFetch<RecognizeResult>('/open/v1/moc/change/recognize', {
|
||||
request_id: nextRequestId('rec'),
|
||||
content,
|
||||
device_tags: deviceTags
|
||||
}
|
||||
});
|
||||
}
|
||||
// aiFetch<RecognizeResult>('/open/v1/moc/change/recognize', {
|
||||
// request_id: nextRequestId('rec'),
|
||||
// content,
|
||||
// device_tags: deviceTags
|
||||
// });
|
||||
|
||||
|
||||
|
||||
|
||||
Vendored
-8
@@ -42,7 +42,6 @@ declare module 'vue' {
|
||||
NCascader: typeof import('naive-ui')['NCascader']
|
||||
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||
NCheckboxGroup: typeof import('naive-ui')['NCheckboxGroup']
|
||||
NCol: typeof import('naive-ui')['NCol']
|
||||
NColorPicker: typeof import('naive-ui')['NColorPicker']
|
||||
NDataTable: typeof import('naive-ui')['NDataTable']
|
||||
NDatePicker: typeof import('naive-ui')['NDatePicker']
|
||||
@@ -57,7 +56,6 @@ declare module 'vue' {
|
||||
NFormItemGi: typeof import('naive-ui')['NFormItemGi']
|
||||
NGi: typeof import('naive-ui')['NGi']
|
||||
NGrid: typeof import('naive-ui')['NGrid']
|
||||
NIcon: typeof import('naive-ui')['NIcon']
|
||||
NInput: typeof import('naive-ui')['NInput']
|
||||
NInputGroup: typeof import('naive-ui')['NInputGroup']
|
||||
NInputNumber: typeof import('naive-ui')['NInputNumber']
|
||||
@@ -65,7 +63,6 @@ declare module 'vue' {
|
||||
NMenu: typeof import('naive-ui')['NMenu']
|
||||
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
|
||||
NModal: typeof import('naive-ui')['NModal']
|
||||
NNInput: typeof import('naive-ui')['NNInput']
|
||||
NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
|
||||
NPagination: typeof import('naive-ui')['NPagination']
|
||||
NPopconfirm: typeof import('naive-ui')['NPopconfirm']
|
||||
@@ -73,7 +70,6 @@ declare module 'vue' {
|
||||
NProgress: typeof import('naive-ui')['NProgress']
|
||||
NRadio: typeof import('naive-ui')['NRadio']
|
||||
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
|
||||
NRow: typeof import('naive-ui')['NRow']
|
||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||
NSelect: typeof import('naive-ui')['NSelect']
|
||||
NSpace: typeof import('naive-ui')['NSpace']
|
||||
@@ -135,7 +131,6 @@ declare global {
|
||||
const NCascader: typeof import('naive-ui')['NCascader']
|
||||
const NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||
const NCheckboxGroup: typeof import('naive-ui')['NCheckboxGroup']
|
||||
const NCol: typeof import('naive-ui')['NCol']
|
||||
const NColorPicker: typeof import('naive-ui')['NColorPicker']
|
||||
const NDataTable: typeof import('naive-ui')['NDataTable']
|
||||
const NDatePicker: typeof import('naive-ui')['NDatePicker']
|
||||
@@ -150,7 +145,6 @@ declare global {
|
||||
const NFormItemGi: typeof import('naive-ui')['NFormItemGi']
|
||||
const NGi: typeof import('naive-ui')['NGi']
|
||||
const NGrid: typeof import('naive-ui')['NGrid']
|
||||
const NIcon: typeof import('naive-ui')['NIcon']
|
||||
const NInput: typeof import('naive-ui')['NInput']
|
||||
const NInputGroup: typeof import('naive-ui')['NInputGroup']
|
||||
const NInputNumber: typeof import('naive-ui')['NInputNumber']
|
||||
@@ -158,7 +152,6 @@ declare global {
|
||||
const NMenu: typeof import('naive-ui')['NMenu']
|
||||
const NMessageProvider: typeof import('naive-ui')['NMessageProvider']
|
||||
const NModal: typeof import('naive-ui')['NModal']
|
||||
const NNInput: typeof import('naive-ui')['NNInput']
|
||||
const NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
|
||||
const NPagination: typeof import('naive-ui')['NPagination']
|
||||
const NPopconfirm: typeof import('naive-ui')['NPopconfirm']
|
||||
@@ -166,7 +159,6 @@ declare global {
|
||||
const NProgress: typeof import('naive-ui')['NProgress']
|
||||
const NRadio: typeof import('naive-ui')['NRadio']
|
||||
const NRadioGroup: typeof import('naive-ui')['NRadioGroup']
|
||||
const NRow: typeof import('naive-ui')['NRow']
|
||||
const NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||
const NSelect: typeof import('naive-ui')['NSelect']
|
||||
const NSpace: typeof import('naive-ui')['NSpace']
|
||||
|
||||
+4
-2
@@ -37,9 +37,11 @@ export default defineConfig(configEnv => {
|
||||
open: true,
|
||||
proxy: {
|
||||
...createViteProxy(viteEnv, enableProxy),
|
||||
// ai-server OpenApi(本地 docker ai-server-ai-1,:12333)
|
||||
// ai-server OpenApi:默认走线上映射域名(https://mocaiapi.djxinxi.net → 192.168.0.230:8085/proxy-ai/ → ai-server:12333,
|
||||
// 网关超时已调至 900s,长耗时接口可用;域名根路径已含 /proxy-ai 映射,故此处剥掉前缀)。
|
||||
// 本地起 docker ai-server 联调时,用环境变量覆盖:AI_SERVER_URL=http://127.0.0.1:12333 pnpm dev
|
||||
'/proxy-ai': {
|
||||
target: process.env.AI_SERVER_URL || 'http://127.0.0.1:12333',
|
||||
target: process.env.AI_SERVER_URL || 'https://mocaiapi.djxinxi.net',
|
||||
changeOrigin: true,
|
||||
rewrite: p => p.replace(/^\/proxy-ai/, '')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user