feat: 调用大模型

This commit is contained in:
zhanghao 2025-09-03 09:16:13 +08:00
parent 97dd210294
commit 13a104a133
5 changed files with 1178 additions and 1176 deletions

View File

@ -1,73 +1,73 @@
import router from './router' import router from './router'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import NProgress from 'nprogress' import NProgress from 'nprogress'
import 'nprogress/nprogress.css' import 'nprogress/nprogress.css'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import { isHttp, isPathMatch } from '@/utils/validate' import { isHttp, isPathMatch } from '@/utils/validate'
import { isRelogin } from '@/utils/request' import { isRelogin } from '@/utils/request'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import useSettingsStore from '@/store/modules/settings' import useSettingsStore from '@/store/modules/settings'
import usePermissionStore from '@/store/modules/permission' import usePermissionStore from '@/store/modules/permission'
NProgress.configure({ showSpinner: false }) NProgress.configure({ showSpinner: false })
const whiteList = ['/login', '/register'] const whiteList = ['/login', '/register']
const isWhiteList = (path) => { const isWhiteList = (path) => {
return whiteList.some(pattern => isPathMatch(pattern, path)) return whiteList.some(pattern => isPathMatch(pattern, path))
} }
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
if (to.meta?.noLogin) { if (to.meta?.noLogin) {
next() next()
return return
} }
NProgress.start() NProgress.start()
if (getToken()) { if (getToken()) {
to.meta.title && useSettingsStore().setTitle(to.meta.title) to.meta.title && useSettingsStore().setTitle(to.meta.title)
/* has token*/ /* has token*/
if (to.path === '/login') { if (to.path === '/login') {
next({ path: '/' }) next({ path: '/' })
NProgress.done() NProgress.done()
} else if (isWhiteList(to.path)) { } else if (isWhiteList(to.path)) {
next() next()
} else { } else {
if (useUserStore().roles.length === 0) { if (useUserStore().roles.length === 0) {
isRelogin.show = true isRelogin.show = true
// 判断当前用户是否已拉取完user_info信息 // 判断当前用户是否已拉取完user_info信息
useUserStore().getInfo().then(() => { useUserStore().getInfo().then(() => {
isRelogin.show = false isRelogin.show = false
usePermissionStore().generateRoutes().then(accessRoutes => { usePermissionStore().generateRoutes().then(accessRoutes => {
// 根据roles权限生成可访问的路由表 // 根据roles权限生成可访问的路由表
accessRoutes.forEach(route => { accessRoutes.forEach(route => {
if (!isHttp(route.path)) { if (!isHttp(route.path)) {
router.addRoute(route) // 动态添加可访问路由表 router.addRoute(route) // 动态添加可访问路由表
} }
}) })
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
}) })
}).catch(err => { }).catch(err => {
useUserStore().logOut().then(() => { useUserStore().logOut().then(() => {
ElMessage.error(err) ElMessage.error(err)
next({ path: '/' }) next({ path: '/' })
}) })
}) })
} else { } else {
next() next()
} }
} }
} else { } else {
// 没有token // 没有token
if (isWhiteList(to.path)) { if (isWhiteList(to.path)) {
// 在免登录白名单,直接进入 // 在免登录白名单,直接进入
next() next()
} else { } else {
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页 next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
NProgress.done() NProgress.done()
} }
} }
}) })
router.afterEach(() => { router.afterEach(() => {
NProgress.done() NProgress.done()
}) })

View File

@ -1,69 +1,69 @@
import useTagsViewStore from '@/store/modules/tagsView' import useTagsViewStore from '@/store/modules/tagsView'
import router from '@/router' import router from '@/router'
export default { export default {
// 刷新当前tab页签 // 刷新当前tab页签
refreshPage(obj) { refreshPage(obj) {
const { path, query, matched } = router.currentRoute.value; const { path, query, matched } = router.currentRoute.value;
if (obj === undefined) { if (obj === undefined) {
matched.forEach((m) => { matched.forEach((m) => {
if (m.components && m.components.default && m.components.default.name) { if (m.components && m.components.default && m.components.default.name) {
if (!['Layout', 'ParentView'].includes(m.components.default.name)) { if (!['Layout', 'ParentView'].includes(m.components.default.name)) {
obj = { name: m.components.default.name, path: path, query: query }; obj = { name: m.components.default.name, path: path, query: query };
} }
} }
}); });
} }
return useTagsViewStore().delCachedView(obj).then(() => { return useTagsViewStore().delCachedView(obj).then(() => {
const { path, query } = obj const { path, query } = obj
router.replace({ router.replace({
path: '/redirect' + path, path: '/redirect' + path,
query: query query: query
}) })
}) })
}, },
// 关闭当前tab页签打开新页签 // 关闭当前tab页签打开新页签
closeOpenPage(obj) { closeOpenPage(obj) {
useTagsViewStore().delView(router.currentRoute.value); useTagsViewStore().delView(router.currentRoute.value);
if (obj !== undefined) { if (obj !== undefined) {
return router.push(obj); return router.push(obj);
} }
}, },
// 关闭指定tab页签 // 关闭指定tab页签
closePage(obj) { closePage(obj) {
if (obj === undefined) { if (obj === undefined) {
return useTagsViewStore().delView(router.currentRoute.value).then(({ visitedViews }) => { return useTagsViewStore().delView(router.currentRoute.value).then(({ visitedViews }) => {
const latestView = visitedViews.slice(-1)[0] const latestView = visitedViews.slice(-1)[0]
if (latestView) { if (latestView) {
return router.push(latestView.fullPath) return router.push(latestView.fullPath)
} }
return router.push('/'); return router.push('/');
}); });
} }
return useTagsViewStore().delView(obj); return useTagsViewStore().delView(obj);
}, },
// 关闭所有tab页签 // 关闭所有tab页签
closeAllPage() { closeAllPage() {
return useTagsViewStore().delAllViews(); return useTagsViewStore().delAllViews();
}, },
// 关闭左侧tab页签 // 关闭左侧tab页签
closeLeftPage(obj) { closeLeftPage(obj) {
return useTagsViewStore().delLeftTags(obj || router.currentRoute.value); return useTagsViewStore().delLeftTags(obj || router.currentRoute.value);
}, },
// 关闭右侧tab页签 // 关闭右侧tab页签
closeRightPage(obj) { closeRightPage(obj) {
return useTagsViewStore().delRightTags(obj || router.currentRoute.value); return useTagsViewStore().delRightTags(obj || router.currentRoute.value);
}, },
// 关闭其他tab页签 // 关闭其他tab页签
closeOtherPage(obj) { closeOtherPage(obj) {
return useTagsViewStore().delOthersViews(obj || router.currentRoute.value); return useTagsViewStore().delOthersViews(obj || router.currentRoute.value);
}, },
// 打开tab页签 // 打开tab页签
openPage(url) { openPage(url) {
return router.push(url); return router.push(url);
}, },
// 修改tab页签 // 修改tab页签
updatePage(obj) { updatePage(obj) {
return useTagsViewStore().updateVisitedView(obj); return useTagsViewStore().updateVisitedView(obj);
} }
} }

View File

@ -1,274 +1,276 @@
import { Group, SelectionSelect } from "@logicflow/extension"; import { Group, SelectionSelect } from "@logicflow/extension";
import { registerCommon } from "./nodes/common/index"; import { registerCommon } from "./nodes/common/index";
import { registerFunction } from './nodes/function' import { registerFunction } from './nodes/function'
import cameraSvg from './icon/camera.svg' import cameraSvg from './icon/camera.svg'
import videoSvg from './icon/video.svg' import videoSvg from './icon/video.svg'
import loopSvg from './icon/loop.svg' import loopSvg from './icon/loop.svg'
import stopLoopSvg from './icon/stopLoop.svg' import stopLoopSvg from './icon/stopLoop.svg'
import switchSvg from './icon/switch.svg' import switchSvg from './icon/switch.svg'
import startSvg from './icon/start.svg' import startSvg from './icon/start.svg'
import endSvg from './icon/end.svg' import endSvg from './icon/end.svg'
import microphoneSvg from './icon/microphone.svg' import microphoneSvg from './icon/microphone.svg'
import sleepSvg from './icon/sleep.svg' import sleepSvg from './icon/sleep.svg'
import { v4 as randomUUID } from 'uuid' import { v4 as randomUUID } from 'uuid'
import { useFlowStore } from "@/store/modules/flow"; import { useFlowStore } from "@/store/modules/flow";
const flowStore = useFlowStore(); const flowStore = useFlowStore();
export const lfConfig = { export const lfConfig = {
idGenerator: () => { idGenerator: () => {
// 生成标准UUID并移除连字符 // 生成标准UUID并移除连字符
// return crypto.randomUUID().replace(/-/g, ''); // return crypto.randomUUID().replace(/-/g, '');
return randomUUID().replace(/-/g, '') return randomUUID().replace(/-/g, '')
}, },
background: { background: {
backgroundColor: "#f6f8fa", backgroundColor: "#f6f8fa",
}, },
grid: false, grid: false,
plugins: [Group, SelectionSelect], plugins: [Group, SelectionSelect],
animation: true, animation: true,
adjustEdgeStartAndEnd: false, adjustEdgeStartAndEnd: false,
// multipleSelectKey: "ctrl", // multipleSelectKey: "ctrl",
// disabledTools: ["multipleSelect"], // disabledTools: ["multipleSelect"],
partial: true, partial: true,
// group: { // group: {
// foldable: true, // 启用折叠功能 // foldable: true, // 启用折叠功能
// foldSize: 30, // 折叠后显示的图标尺寸 // foldSize: 30, // 折叠后显示的图标尺寸
// }, // },
edgeType: "bezier", edgeType: "bezier",
style: { style: {
anchor: { anchor: {
show: true, // 强制全局锚点显示 show: true, // 强制全局锚点显示
hoverOn: false, hoverOn: false,
visibility: "visible", visibility: "visible",
fill: "#FF5722", // 实心绿色 fill: "#FF5722", // 实心绿色
stroke: "#FF5722", // 边框同色 stroke: "#FF5722", // 边框同色
strokeWidth: 0, // 消除边框 strokeWidth: 0, // 消除边框
r: 7, // 锚点半径 r: 7, // 锚点半径
hover: { fill: "#FF5722" }, // 禁用悬停变色 hover: { fill: "#FF5722" }, // 禁用悬停变色
}, },
anchorLine: { anchorLine: {
stroke: "#FF5722", stroke: "#FF5722",
strokeWidth: 2, strokeWidth: 2,
strokeDasharray: "3,2", strokeDasharray: "3,2",
}, },
bezier: { bezier: {
stroke: "#FF5722", stroke: "#FF5722",
strokeWidth: 2, strokeWidth: 2,
arrow: false, // 关闭箭头显示 arrow: false, // 关闭箭头显示
animation: true, // 开启动画效果 animation: true, // 开启动画效果
animationSpeed: 3, animationSpeed: 3,
}, },
}, },
}; };
// 注册自定义节点 // 注册自定义节点
export const registerCustomizeNode = (lf) => { export const registerCustomizeNode = (lf) => {
registerCommon(lf) registerCommon(lf)
registerFunction(lf) registerFunction(lf)
}; };
const deviceOptions = () => { const deviceOptions = () => {
return ['cam1', 'cam2', 'cam3', 'cam4'] return ['cam1', 'cam2', 'cam3', 'cam4']
} }
const audioOptions = () => { const audioOptions = () => {
return ['spk1'] return ['spk1']
} }
export const collapseList = [ export const collapseList = [
{ {
collapseTitle: "相机", collapseTitle: "相机",
nodeList: [ nodeList: [
{ {
icon: cameraSvg, icon: cameraSvg,
name: "开启相机", name: "开启相机",
type: "serviceNode", type: "serviceNode",
desc: "在获取相机照片时,需要先启动相机", desc: "在获取相机照片时,需要先启动相机",
action: 'CAMERA_START', action: 'CAMERA_START',
nodeParams: [ nodeParams: [
{ name: "deviceId", type: "input", input: "", componentType: 'select', selectOptions: deviceOptions(), disabled: true } { name: "deviceId", type: "input", input: "", componentType: 'select', selectOptions: deviceOptions(), disabled: true }
], ],
outputType: 'json' outputType: 'json'
}, },
{ {
icon: cameraSvg, icon: cameraSvg,
name: "获取图片", name: "获取图片",
type: "serviceNode", type: "serviceNode",
desc: "获取相机拍摄的照片", desc: "获取相机拍摄的照片",
action: 'CAMERA_GETRGBIMAGE', action: 'CAMERA_GETRGBIMAGE',
nodeParams: [ nodeParams: [
{ name: "deviceId", type: "input", input: "", componentType: 'select', selectOptions: deviceOptions(), disabled: true } { name: "deviceId", type: "input", input: "", componentType: 'select', selectOptions: deviceOptions(), disabled: true }
], ],
outputType: 'img', outputType: 'img',
outputParams: [{ name: 'imageUrl', type: 'Array<String>', desc: '图片地址数组'}] outputParams: [{ name: 'imageUrl', type: 'Array<String>', desc: '图片地址数组'}]
}, },
{ {
icon: cameraSvg, icon: cameraSvg,
name: "关闭相机", name: "关闭相机",
type: "serviceNode", type: "serviceNode",
desc: "获取相机照片后,关闭该相机", desc: "获取相机照片后,关闭该相机",
action: 'CAMERA_STOP', action: 'CAMERA_STOP',
nodeParams: [ nodeParams: [
{ name: "deviceId", type: "input", input: "", componentType: 'select', selectOptions: deviceOptions(), disabled: true } { name: "deviceId", type: "input", input: "", componentType: 'select', selectOptions: deviceOptions(), disabled: true }
], ],
outputType: 'json' outputType: 'json'
}, },
], ],
}, },
{ {
collapseTitle: "录像", collapseTitle: "录像",
nodeList: [ nodeList: [
{ {
icon: videoSvg, icon: videoSvg,
name: "开启录像", name: "开启录像",
type: "serviceNode", type: "serviceNode",
desc: "开启摄像头,并开始录像", desc: "开启摄像头,并开始录像",
action: 'CAMERA_RECORDING_START', action: 'CAMERA_RECORDING_START',
nodeParams: [ nodeParams: [
{ name: "deviceId", type: "input", input: "", componentType: 'select', selectOptions: deviceOptions(), disabled: true } { name: "deviceId", type: "input", input: "", componentType: 'select', selectOptions: deviceOptions(), disabled: true }
], ],
outputType: 'json' outputType: 'json'
}, },
{ {
icon: videoSvg, icon: videoSvg,
name: "结束录像", name: "结束录像",
type: "serviceNode", type: "serviceNode",
desc: "停止录像,并关闭摄像头", desc: "停止录像,并关闭摄像头",
action: 'CAMERA_RECORDING_STOP', action: 'CAMERA_RECORDING_STOP',
nodeParams: [ nodeParams: [
{ name: "deviceId", type: "input", input: "", componentType: 'select', selectOptions: deviceOptions(), disabled: true } { name: "deviceId", type: "input", input: "", componentType: 'select', selectOptions: deviceOptions(), disabled: true }
], ],
outputType: 'video', outputType: 'video',
outputParams: [{ name: 'videoUrl', type: 'Array<String>', desc: '视频播放地址数组'}] outputParams: [{ name: 'videoUrl', type: 'Array<String>', desc: '视频播放地址数组'}]
} }
], ],
}, },
{ {
collapseTitle: "功能", collapseTitle: "功能",
nodeList: [ nodeList: [
{ {
icon: loopSvg, icon: loopSvg,
name: "循环", name: "循环",
type: "loop", type: "loop",
action: 'START_LOOP', action: 'START_LOOP',
desc: "实现对列表对象循环执行一系列任务", desc: "实现对列表对象循环执行一系列任务",
}, },
{ {
icon: stopLoopSvg, icon: stopLoopSvg,
name: "结束循环", name: "结束循环",
type: "stopLoop", type: "stopLoop",
action: 'STOP_LOOP', action: 'STOP_LOOP',
desc: "用于立即终止当前所在的循环,跳出循环体", desc: "用于立即终止当前所在的循环,跳出循环体",
}, },
{ {
icon: startSvg, icon: startSvg,
name: "单次循环开始", name: "单次循环开始",
type: "subStart", type: "subStart",
action: 'SUB_START', action: 'SUB_START',
desc: "循环体内部工作流的开始节点,开始循环体内部的单次流程", desc: "循环体内部工作流的开始节点,开始循环体内部的单次流程",
}, },
{ {
icon: endSvg, icon: endSvg,
name: "单次循环结束", name: "单次循环结束",
type: "subEnd", type: "subEnd",
action: 'SUB_END', action: 'SUB_END',
desc: "循环体内部工作流的终止节点,结束循环体内部的单次流程", desc: "循环体内部工作流的终止节点,结束循环体内部的单次流程",
}, },
{ {
icon: switchSvg, icon: switchSvg,
name: "分支", name: "分支",
type: "branch", type: "branch",
action: 'BRANCH', action: 'BRANCH',
desc: "连接多个下游分支,根据设定的条件按照顺序查找的方式来匹配运行的分支,如果匹配到某条件则只运行该条件对应的分支,否则继续匹配下一条件直至结束", desc: "连接多个下游分支,根据设定的条件按照顺序查找的方式来匹配运行的分支,如果匹配到某条件则只运行该条件对应的分支,否则继续匹配下一条件直至结束",
}, },
{ {
icon: sleepSvg, icon: sleepSvg,
name: "睡眠", name: "睡眠",
type: "sleep", type: "sleep",
desc: "用于睡眠整个流程,表示延迟多少毫秒", desc: "用于睡眠整个流程,表示延迟多少毫秒",
action: 'sleep', action: 'sleep',
nodeParams: [ nodeParams: [
{ name: "delayMs", type: "input", componentType: 'number', input: "", disabled: true } { name: "delayMs", type: "input", componentType: 'number', input: "", disabled: true }
], ],
outputType: 'json' outputType: 'json'
}, },
], ],
}, },
{ {
collapseTitle: "机器人", collapseTitle: "机器人",
nodeList: [ nodeList: [
{ {
icon: videoSvg, icon: videoSvg,
name: "机械臂", name: "机械臂",
type: "serviceNode", type: "serviceNode",
desc: "控制机器人的手臂", desc: "控制机器人的手臂",
action: 'ALM', action: 'ALM',
nodeParams: [ nodeParams: [
{ name: "deviceId", type: "input", input: "", disabled: true } { name: "deviceId", type: "input", input: "", disabled: true }
], ],
outputType: 'json' outputType: 'json'
}, },
], ],
}, },
{ {
collapseTitle: "音频", collapseTitle: "音频",
nodeList: [ nodeList: [
{ {
icon: microphoneSvg, icon: microphoneSvg,
name: "启动麦克风", name: "启动麦克风",
type: "serviceNode", type: "serviceNode",
desc: "用于启动麦克风的节点", desc: "用于启动麦克风的节点",
action: 'MICROPHONE_START', action: 'MICROPHONE_START',
nodeParams: [ nodeParams: [
{ name: "deviceId", type: "input", input: "", componentType: 'select', selectOptions: deviceOptions(), disabled: true } { name: "deviceId", type: "input", input: "", componentType: 'select', selectOptions: deviceOptions(), disabled: true }
], ],
outputType: 'json' outputType: 'json'
}, },
{ {
icon: microphoneSvg, icon: microphoneSvg,
name: "停止麦克风", name: "停止麦克风",
type: "serviceNode", type: "serviceNode",
desc: "用于停止麦克风的节点", desc: "用于停止麦克风的节点",
action: 'MICROPHONE_START', action: 'MICROPHONE_START',
nodeParams: [ nodeParams: [
{ name: "deviceId", type: "input", input: "", componentType: 'select', selectOptions: deviceOptions(), disabled: true } { name: "deviceId", type: "input", input: "", componentType: 'select', selectOptions: deviceOptions(), disabled: true }
], ],
outputType: 'json' outputType: 'json'
}, },
{ {
icon: microphoneSvg, icon: microphoneSvg,
name: "播放音频", name: "播放音频",
type: "serviceNode", type: "serviceNode",
desc: "用于播放音频的节点", desc: "用于播放音频的节点",
action: 'SPEAKER_PLAYAUDIO', action: 'SPEAKER_PLAYAUDIO',
nodeParams: [ nodeParams: [
{ name: "deviceId", type: "input", input: "", componentType: 'select', selectOptions: audioOptions(), disabled: true } { name: "deviceId", type: "input", input: "", componentType: 'select', selectOptions: audioOptions(), disabled: true }
], ],
outputType: 'json' outputType: 'json'
}, },
], ],
}, },
{ {
collapseTitle: "大模型", collapseTitle: "大模型",
nodeList: [ nodeList: [
{ {
icon: microphoneSvg, icon: microphoneSvg,
name: "获取触控坐标", name: "获取触控坐标",
type: "serviceNode", type: "serviceNode",
desc: "用于获取触控坐标的节点", desc: "用于获取触控坐标的节点",
action: 'TOUCH_COORDINATES', action: 'TOUCH_COORDINATES',
nodeParams: [ nodeParams: [
{ name: "words", type: "input", input: "", disabled: true } { name: "targetFeature", type: "input", input: "运动模式", disabled: true },
], { name: "manufacturer", type: "input", input: "xiaomi", disabled: true },
outputType: 'json', { name: "vehType", type: "input", input: "su7", disabled: true },
outputParams: [{ name: 'coordinates', type: 'Object', desc: '坐标对象'}] ],
}, outputType: 'json',
], outputParams: [{ name: 'coordinates', type: 'Object', desc: '坐标对象'}]
}, },
] ],
},
]

File diff suppressed because it is too large Load Diff

View File

@ -1,68 +1,68 @@
import {defineConfig, loadEnv, normalizePath} from 'vite' import {defineConfig, loadEnv, normalizePath} from 'vite'
import path from 'path' import path from 'path'
import createVitePlugins from './vite/plugins' import createVitePlugins from './vite/plugins'
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig(({mode, command}) => { export default defineConfig(({mode, command}) => {
const env = loadEnv(mode, process.cwd()) const env = loadEnv(mode, process.cwd())
const {VITE_APP_ENV, VITE_API_URL} = env const {VITE_APP_ENV, VITE_API_URL} = env
const variablePath = normalizePath(path.resolve('./src/style/variable.scss')); const variablePath = normalizePath(path.resolve('./src/style/variable.scss'));
return { return {
// 部署生产环境和开发环境下的URL。 // 部署生产环境和开发环境下的URL。
// 默认情况下vite 会假设你的应用是被部署在一个域名的根路径上 // 默认情况下vite 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。 // 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
base: VITE_APP_ENV === 'production' ? '/' : '/', base: VITE_APP_ENV === 'production' ? '/' : '/',
plugins: createVitePlugins(env, command === 'build'), plugins: createVitePlugins(env, command === 'build'),
resolve: { resolve: {
// https://cn.vitejs.dev/config/#resolve-alias // https://cn.vitejs.dev/config/#resolve-alias
alias: { alias: {
// 设置路径 // 设置路径
'~': path.resolve(__dirname, './'), '~': path.resolve(__dirname, './'),
// 设置别名 // 设置别名
'@': path.resolve(__dirname, './src') '@': path.resolve(__dirname, './src')
}, },
// https://cn.vitejs.dev/config/#resolve-extensions // https://cn.vitejs.dev/config/#resolve-extensions
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'] extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
}, },
// vite 相关配置 // vite 相关配置
server: { server: {
port: 13080, port: 13080,
host: true, host: true,
open: true, open: true,
proxy: { proxy: {
// https://cn.vitejs.dev/config/#server-proxy // https://cn.vitejs.dev/config/#server-proxy
'/dev-api': { '/dev-api': {
//杨 http://10.148.108.95:13080 //杨 http://192.168.1.10:13080
//赵 http://10.148.108.58:13080 //赵 http://10.148.108.58:13080
// dev http://10.148.20.34:13080 // dev http://10.148.20.34:13080
// target: command === 'build' ? VITE_API_URL : 'http://10.148.20.34:13080', // target: command === 'build' ? VITE_API_URL : 'http://10.148.20.34:13080',
target: command === 'build' ? VITE_API_URL : 'http://10.148.108.95:13080', target: command === 'build' ? VITE_API_URL : 'http://192.168.1.10:13080',
changeOrigin: true, changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, '') rewrite: (p) => p.replace(/^\/dev-api/, '')
} }
} }
}, },
//fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file //fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file
css: { css: {
postcss: { postcss: {
plugins: [ plugins: [
{ {
postcssPlugin: 'internal:charset-removal', postcssPlugin: 'internal:charset-removal',
AtRule: { AtRule: {
charset: (atRule) => { charset: (atRule) => {
if (atRule.name === 'charset') { if (atRule.name === 'charset') {
atRule.remove(); atRule.remove();
} }
} }
} }
} }
] ]
}, },
preprocessorOptions: { preprocessorOptions: {
scss: { scss: {
additionalData: `@import "${variablePath}";` additionalData: `@import "${variablePath}";`
}, },
}, },
} }
} }
}) })