实现AI生成测试项接口
This commit is contained in:
897
cdTMP/package-lock.json
generated
897
cdTMP/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -13,13 +13,13 @@
|
||||
"dependencies": {
|
||||
"@arco-design/color": "^0.4.0",
|
||||
"@arco-design/web-vue": "^2.58.0",
|
||||
"@tanstack/vue-query": "^5.100.1",
|
||||
"@tanstack/vue-query": "^5.100.14",
|
||||
"@tinymce/tinymce-vue": "^6.3.0",
|
||||
"@vueuse/core": "^14.2.1",
|
||||
"axios": "^1.15.2",
|
||||
"@vueuse/core": "^14.3.0",
|
||||
"axios": "^1.16.1",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"dayjs": "^1.11.20",
|
||||
"dayjs": "^1.11.21",
|
||||
"file2md5": "^1.3.0",
|
||||
"lodash-es": "^4.18.1",
|
||||
"mammoth": "^1.12.0",
|
||||
@@ -28,38 +28,38 @@
|
||||
"pinia": "^3.0.4",
|
||||
"pinyin-match": "^1.2.10",
|
||||
"postcss-import": "^16.1.1",
|
||||
"qs": "^6.15.1",
|
||||
"tailwind-merge": "^3.5.0",
|
||||
"qs": "^6.15.2",
|
||||
"tailwind-merge": "^3.6.0",
|
||||
"tinymce": "^7.9.1",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"vue": "^3.5.33",
|
||||
"vue": "^3.5.35",
|
||||
"vue-clipboard3": "^2.0.0",
|
||||
"vue-color-kit": "^1.0.6",
|
||||
"vue-data-ui": "^3.17.13",
|
||||
"vue-router": "^5.0.6",
|
||||
"vue-data-ui": "^3.20.11",
|
||||
"vue-router": "^5.1.0",
|
||||
"vuedraggable": "^2.24.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/postcss": "^4.2.4",
|
||||
"@tailwindcss/vite": "^4.2.4",
|
||||
"@tailwindcss/postcss": "^4.3.0",
|
||||
"@tailwindcss/vite": "^4.3.0",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "^25.6.0",
|
||||
"@types/node": "^25.9.1",
|
||||
"@types/nprogress": "^0.2.3",
|
||||
"@types/qs": "^6.15.0",
|
||||
"@vitejs/plugin-vue": "^6.0.6",
|
||||
"@types/qs": "^6.15.1",
|
||||
"@vitejs/plugin-vue": "^6.0.7",
|
||||
"@vitejs/plugin-vue-jsx": "^5.1.5",
|
||||
"@vue/babel-plugin-jsx": "^2.0.1",
|
||||
"browserslist": "^4.28.2",
|
||||
"eslint": "^10.2.1",
|
||||
"eslint-plugin-vue": "^10.9.0",
|
||||
"eslint": "^10.4.0",
|
||||
"eslint-plugin-vue": "^10.9.1",
|
||||
"less": "^4.6.4",
|
||||
"less-loader": "^12.3.2",
|
||||
"postcss": "^8.5.10",
|
||||
"less-loader": "^13.0.0",
|
||||
"postcss": "^8.5.15",
|
||||
"prettier": "^3.8.3",
|
||||
"rollup-plugin-visualizer": "^7.0.1",
|
||||
"tailwindcss": "^4.2.4",
|
||||
"tailwindcss": "^4.3.0",
|
||||
"typescript": "^6.0.3",
|
||||
"vite": "^8.0.10",
|
||||
"vite": "^8.0.14",
|
||||
"vue-eslint-parser": "^10.4.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,30 @@
|
||||
import { request } from "@/api/request"
|
||||
|
||||
const AI_API_BASE = import.meta.env.VUE_APP_AI_API_BASE || "http://192.168.0.63:8777"
|
||||
|
||||
interface DataRowType {
|
||||
question: string
|
||||
stream: boolean
|
||||
}
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 请求AI生成测试项
|
||||
* @returns 可流式或一次性
|
||||
*/
|
||||
getAiTestItem(data: DataRowType) {
|
||||
return request({
|
||||
url: import.meta.env.DEV ? `/local_doc_qa/testing_item` : `${AI_API_BASE}/api/local_doc_qa/testing_item`,
|
||||
timeout: 120000,
|
||||
method: "post",
|
||||
data
|
||||
})
|
||||
}
|
||||
}
|
||||
import { request } from "@/api/request"
|
||||
|
||||
const AI_API_BASE = import.meta.env.VUE_APP_AI_API_BASE || "http://192.168.0.63:8777"
|
||||
|
||||
interface DataRowType {
|
||||
question: string
|
||||
streaming: boolean
|
||||
model_name: string
|
||||
user_focus_points: string
|
||||
project_type: "cpu" | "fpga" | "other"
|
||||
}
|
||||
|
||||
interface DataType {
|
||||
question: string
|
||||
project_type: "cpu" | "fpga" | "other"
|
||||
}
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 改为请求测试平台后端然后请求大模型方式
|
||||
*/
|
||||
getAiTestItemBackend(data: DataType) {
|
||||
return request({
|
||||
url: "/local_doc_qa/testing_item",
|
||||
method: "post",
|
||||
timeout: 120000,
|
||||
data
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,18 +160,20 @@ const fetchTestType = async () => {
|
||||
}
|
||||
fetchTestType()
|
||||
|
||||
const designObj: any = ref()
|
||||
|
||||
// 初始化设计需求
|
||||
const currentKey: string = route.query.key as string
|
||||
const getDesign = async () => {
|
||||
try {
|
||||
const res = await designApi.getDesignDemandOne({ project_id: route.query.id, key: route.query.key })
|
||||
designObj.value = res.data
|
||||
const resResult = await designApi.getDesignDemandOne({ project_id: route.query.id, key: route.query.key })
|
||||
designObj.value = resResult.data
|
||||
} catch (e) {
|
||||
console.log("调试错误信息:", e)
|
||||
Message.error("初始化设计需求信息错误,请检查网络后重试!")
|
||||
}
|
||||
}
|
||||
getDesign()
|
||||
const designObj: any = ref()
|
||||
|
||||
// 进度条和列表加载loading
|
||||
const percent = ref(0.0)
|
||||
@@ -188,16 +190,8 @@ const generateClick = async () => {
|
||||
// 变量:给AI的问题
|
||||
const question = tool.htmlToTextWithDOM(designObj.value?.description || "")
|
||||
// 请求后处理结果
|
||||
const res = await aiApi.getAiTestItem({ question: question, stream: false })
|
||||
// 判断真实接口和开发环境接口
|
||||
let tempSolve: any = null
|
||||
if (res.data) {
|
||||
// 说明是开发环境
|
||||
tempSolve = res.data
|
||||
} else {
|
||||
tempSolve = res
|
||||
}
|
||||
const solveRes = JSON.parse(tempSolve.history[0].at(-1))
|
||||
const res = await aiApi.getAiTestItemBackend({ question: question, project_type: isFPGA ? "fpga" : "cpu" })
|
||||
const solveRes = JSON.parse(res.data.history[0].at(-1))
|
||||
console.log("AI生成测试项结果:", solveRes)
|
||||
// 给Vue渲染测试项
|
||||
dataList.value = solveRes
|
||||
|
||||
@@ -33,7 +33,19 @@ export default ({ mode }) => {
|
||||
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false
|
||||
},
|
||||
build: {
|
||||
chunkSizeWarningLimit: 3000
|
||||
chunkSizeWarningLimit: 3000,
|
||||
rolldownOptions: {
|
||||
output: {
|
||||
codeSplitting: {
|
||||
groups: [
|
||||
{
|
||||
name: "arco-design",
|
||||
test: /[\\/]node_modules[\\/]@arco-design[\\/]web-vue[\\/]/
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
// assetsPublicPath: "./"
|
||||
// v8版本又报tinymce is not defined,只有遗憾业务js大的问题
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user