Commit b62a22ec authored by mhw's avatar mhw

版本跟新

parent b7558ad7
......@@ -6,11 +6,12 @@ export default class DatasetData {
static view (sender, params, axiosOption, httpOption) {
return sender.doUrl('/admin/app/datasetData/view', 'get', params, axiosOption, httpOption);
}
static update (sender, params, axiosOption, httpOption) {
return sender.doUrl('/admin/app/datasetData/update', 'post', params, axiosOption, httpOption);
}
static add (sender, params, axiosOption, httpOption) {
return sender.doUrl('/admin/app/datasetData/add', 'post', params, axiosOption, httpOption);
}
static delete (sender, params, axiosOption, httpOption) {
return sender.doUrl('/admin/app/datasetData/delete', 'post', params, axiosOption, httpOption);
}
......@@ -20,5 +21,4 @@ export default class DatasetData {
static summaryCount (sender, params, axiosOption, httpOption) {
return sender.doUrl('/admin/app/datasetData/summaryCount', 'get', params, axiosOption, httpOption);
}
DatasetData
}
module.exports = {
// baseUrl: 'http://218.76.0.69:8082/',
baseUrl: 'http://192.168.0.34:8082/',
// baseUrl: 'http://192.168.0.34:8082/',
// baseUrl: 'http://192.168.0.36:8082/',
// baseUrl: 'http://192.168.0.168:8082/',
baseUrl: 'http://192.168.0.36:8082/',
wsUrl: 'ws://218.76.0.69:7860/',
projectName: '灵境大模型平台'
}
......@@ -101,9 +101,8 @@ class GetStreaming {
} catch {
console.error('onmessage error');
}
that.onmessage(data)
console.info(data);
if (data.status === 0) {
that.onmessage(JSON.stringify(data))
if (data?.status === 0) {
that.success()
}
},
......
......@@ -15,6 +15,7 @@ class SocketService {
}
// 初始化weosocket
async initWebSocket () {
console.log(1111123123123123);
this.ws = await new WebSocket(this.url);
this.ws.onopen = await this.websocketonopen.bind(this);
this.ws.onerror = await this.websocketonerror.bind(this);
......@@ -63,6 +64,9 @@ class SocketService {
websocketclose (e) { // 关闭
// Message('connection closed (' + e.code + ')')
}
close () {
this.ws.close();
}
}
export { SocketService }
......@@ -31,10 +31,10 @@ import { DatasetData } from '@/api/gptController.js'
export default {
data() {
return {
form: JSON.parse(JSON.stringify(this.row))
form: this.deepCopy(this.row)
}
},
props: ['row', 'columnList', 'refresh', 'isEdit'],
props: ['row', 'columnList', 'refresh', 'isEdit', 'versionId'],
components: {},
computed: {},
......@@ -42,6 +42,13 @@ export default {
mounted() {},
methods: {
deepCopy(data) {
try {
return JSON.parse(JSON.stringify(data))
} catch (error) {
return { data: { instruction: '', output: '' } }
}
},
onCancel(isSuccess) {
if (this.observer != null) {
this.observer.cancel(isSuccess)
......@@ -50,9 +57,10 @@ export default {
onSubmit() {
let params = {}
params.datasetMongoDto = this.form
DatasetData.update(this, params)
params.datasetMongoDto.versionId = this.versionId
DatasetData[this.versionId ? 'add' : 'update'](this, params)
.then((res) => {
this.$message.success('编辑成功')
this.$message.success(this.versionId ? '添加成功' : '编辑成功')
this.onCancel(true)
})
.catch((e) => {})
......
......@@ -2,17 +2,20 @@
<template>
<div class="tableBox">
<div class="topBox">
<el-breadcrumb separator="|">
<el-breadcrumb-item :class="nowPage==0?'isactive':''" @click.native="breadcrumbClick(0)">全部({{ allNum}}</el-breadcrumb-item>
<el-breadcrumb-item :class="nowPage==1?'isactive':''" @click.native="breadcrumbClick(1)">无标注信息({{ unmarkedNum}}</el-breadcrumb-item>
<el-breadcrumb-item :class="nowPage==2?'isactive':''" @click.native="breadcrumbClick(2)">有标注信息({{ markedNum}}</el-breadcrumb-item>
</el-breadcrumb>
<el-button :size="defaultFormItemSize" @click="add()">新增</el-button>
</div>
<vxe-table border show-header-overflow show-overflow :row-config="{ isHover: true }" :data="myDataSetPage.tableData.impl.dataList" min-height="96">
<!-- <vxe-column field="index" title="序号"></vxe-column> -->
<!-- <vxe-column :field="'data.'+item" :title="item" v-for="item in columnList" :key="item"></vxe-column> -->
<vxe-column field="data.instruction" title="问题"></vxe-column>
<vxe-column field="data.output" title="回答"></vxe-column>
<vxe-column field="operation" title="操作" width="150px">
<template slot-scope="scope">
<el-button type="text" :size="defaultFormItemSize" @click="check(scope.row)">查看</el-button>
......@@ -150,9 +153,28 @@ export default {
)
.then((res) => {
this.refresh()
this.summaryCount()
})
.catch((e) => {})
},
add() {
// 添加
this.$dialog
.show(
'添加',
label,
{
area: ['70%', '50%']
},
{ versionId: this.versionItem.versionId, refresh: this.refresh, isEdit: true }
)
.then((res) => {
this.refresh()
this.summaryCount()
})
.catch((e) => {})
},
del(item) {
this.$confirm('是否确认删除', '提示', {
confirmButtonText: '确定',
......@@ -164,6 +186,7 @@ export default {
.then((res) => {
this.$message.success('删除成功')
this.refresh()
this.summaryCount()
})
.catch((e) => {
console.log(e)
......@@ -282,4 +305,10 @@ export default {
/deep/ .isactive .el-breadcrumb__inner {
color: #0092ff !important;
}
.topBox {
display: flex;
height: auto;
align-items: center;
justify-content: space-between;
}
</style>
<!--详情 -->
<template>
<div class="tableBox">
<el-breadcrumb separator="|">
<el-breadcrumb-item :class="nowPage==0?'isactive':''" @click.native="breadcrumbClick(0)">全部({{ allNum}}</el-breadcrumb-item>
......@@ -150,6 +149,7 @@ export default {
)
.then((res) => {
this.refresh()
this.summaryCount()
})
.catch((e) => {})
},
......@@ -164,6 +164,7 @@ export default {
.then((res) => {
this.$message.success('删除成功')
this.refresh()
this.summaryCount()
})
.catch((e) => {
console.log(e)
......
......@@ -11,11 +11,11 @@
</template>
<script>
import Clipboard from 'clipboard';
import { TuningRun } from '@/api/gptController.js';
import Clipboard from 'clipboard'
import { TuningRun } from '@/api/gptController.js'
// import { getSessionHash } from '@/utils/index';
export default {
data () {
data() {
return {
clipboard: null,
result: '',
......@@ -26,59 +26,62 @@ export default {
fn_index: 18,
session_hash: this.item.runId
}
};
}
},
components: {},
computed: {
resultAdjust () {
resultAdjust() {
return this.result.replace(/\n/g, '<br/>').replace('```bash', '')
}
},
props: ['item'],
mounted () {
mounted() {
this.SocketService.initWebSocket()
this.clipboard = new Clipboard(this.$refs.copy.$el);
this.clipboard = new Clipboard(this.$refs.copy.$el)
},
methods: {
successful () { // 连接成功
successful() {
// 连接成功
this.send(`{"fn_index":${this.wsData.fn_index},"session_hash":"${this.wsData.session_hash}"}`)
this.getPreviewCommand()
},
getPreviewCommand () { // 获取参数
TuningRun.getPreviewCommand(this, {runId: this.item.runId}).then((res) => {
getPreviewCommand() {
// 获取参数
TuningRun.getPreviewCommand(this, { runId: this.item.runId }).then((res) => {
this.wsData.data = res.data
this.send(JSON.stringify(this.wsData))
})
},
send (data) { // 发送参数
send(data) {
// 发送参数
this.SocketService.websocketsend(data)
},
websocketonmessage (e) { // 返回接收参数
websocketonmessage(e) {
// 返回接收参数
console.log(e)
if (JSON.parse(e.data).msg === 'process_generating') {
this.result = JSON.parse(e.data).output.data[0]
}
},
copy () {
copy() {
try {
this.clipboard.on('success', e => {
this.$message.success('接入信息复制成功!');
this.clipboard.on('success', (e) => {
this.$message.success('接入信息复制成功!')
this.clipboard = null
});
this.clipboard.on('error', e => {
this.$message.error('浏览器不支持复制');
})
this.clipboard.on('error', (e) => {
this.$message.error('浏览器不支持复制')
this.clipboard = null
});
})
} catch (e) {
console.log(e);
console.log(e)
}
}
}
}
</script>
<style scoped>
</style>
<!-- 任务列表操作 -->
<template>
<div class="tableBox">
<el-button :size="defaultFormItemSize" type="primary" @click="preview">预览命令</el-button>
<el-button :size="defaultFormItemSize" type="primary" @click="start" :disabled="istraining" >开始训练</el-button>
<el-button :size="defaultFormItemSize" type="primary" @click="start" :disabled="istraining">开始训练</el-button>
<el-button :size="defaultFormItemSize" type="primary" @click="pause" :disabled="!istraining">中断训练</el-button>
<el-tabs v-model="activeName" :size="defaultFormItemSize">
<el-tab-pane label="运行详情" name="particulars"><particulars :item="item" /></el-tab-pane>
<el-tab-pane label="评估报告" name="assessmentReport"><assessmentReport ref="assessmentReport" :item="item" :result="result" :img="img" /></el-tab-pane>
<el-tab-pane label="训练日志" name="trainingLog"><trainingLog :item="item" :result="result" /></el-tab-pane>
<el-tab-pane label="运行详情" name="particulars">
<particulars :item="item" />
</el-tab-pane>
<el-tab-pane label="评估报告" name="assessmentReport">
<assessmentReport ref="assessmentReport" :item="item" :result="result" :img="img" />
</el-tab-pane>
<el-tab-pane label="训练日志" name="trainingLog">
<trainingLog :item="item" :result="result" />
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import particulars from './operate/particulars';
import assessmentReport from './operate/assessmentReport';
import trainingLog from './operate/trainingLog';
import particulars from './operate/particulars'
import assessmentReport from './operate/assessmentReport'
import trainingLog from './operate/trainingLog'
// eslint-disable-next-line no-unused-vars
import previewCommand from './previewCommand';
import previewCommand from './previewCommand'
// import { getSessionHash } from '@/utils/index';
import { TuningRun, PyApi } from '@/api/gptController.js';
import { TuningRun, PyApi } from '@/api/gptController.js'
export default {
data () {
data() {
return {
istraining: false, // 是否在训练中
img: '',
......@@ -36,34 +41,32 @@ export default {
},
activeName: this.page,
timeImg: null
};
}
},
props: ['page', 'item'],
components: {particulars, assessmentReport, trainingLog},
components: { particulars, assessmentReport, trainingLog },
computed: {},
mounted () {
},
mounted() {},
methods: {
PyApi (index, data = []) {
PyApi(index, data = []) {
let param = {
data: data,
event_data: null,
fn_index: index,
session_hash: this.item.runId
}
return PyApi.predict(this, param).then((res) => {
if (index === 22) { // 图片
if (index === 22) {
// 图片
// console.log(res);
this.img = JSON.parse(res.data).data[0]?.plot;
this.img = JSON.parse(res.data).data[0]?.plot
console.log(this.img);
} else if (index === 20) { // 暂停
console.log(this.img)
} else if (index === 20) {
// 暂停
this.$message({
message: '已暂停',
type: 'success'
......@@ -72,62 +75,76 @@ export default {
// this.result = {output: {data: []}}
})
},
preview () {
this.$dialog.show('预览命令', previewCommand, {
preview() {
this.$dialog
.show(
'预览命令',
previewCommand,
{
area: ['50%', '70%']
}, {item: this.item}).then(res => {
this.refresh();
}).catch(e => { });
},
start () {
{ item: this.item }
)
.then((res) => {
this.refresh()
})
.catch((e) => {})
},
start() {
this.SocketService.initWebSocket()
},
async pause () {
async pause() {
await this.PyApi(20)
TuningRun.updateById(this, {tuningRunDto: {runId: this.item.runId, runStatus: -2}}).then(res => {
console.log(res);
}).catch(e => {
});
TuningRun.updateById(this, { tuningRunDto: { runId: this.item.runId, runStatus: -2 } })
.then((res) => {
console.log(res)
})
.catch((e) => {})
},
getPreviewCommand () { // 获取参数
TuningRun.getPreviewCommand(this, {runId: this.item.runId}).then((res) => {
getPreviewCommand() {
// 获取参数
TuningRun.getPreviewCommand(this, { runId: this.item.runId }).then((res) => {
this.wsData.data = res.data
this.send(JSON.stringify(this.wsData))
})
},
successful () { // 连接成功
successful() {
// 连接成功
this.send(`{"fn_index":${this.wsData.fn_index},"session_hash":"${this.wsData.session_hash}"}`)
// this.getPreviewCommand()
},
send (data) { // 发送参数
send(data) {
// 发送参数
this.SocketService.websocketsend(data)
},
websocketonmessage (e) { // 返回接收参数
if (JSON.parse(e.data).msg === 'process_generating') { // 开始训练
websocketonmessage(e) {
// 返回接收参数
if (JSON.parse(e.data).msg === 'process_generating') {
// 开始训练
this.istraining = true
this.result = JSON.parse(e.data)
if (!this.timeImg) {
// this.startGetImg()
}
} else if (JSON.parse(e.data).msg === 'process_completed') { // 训练结束
} else if (JSON.parse(e.data).msg === 'process_completed') {
// 训练结束
this.$refs.assessmentReport.completed()
clearInterval(this.timeImg)
this.timeImg = null
this.istraining = false
this.$refs.assessmentReport.init(true)
} else if (JSON.parse(e.data).msg === 'send_data') { // 可以发送训练数据
} else if (JSON.parse(e.data).msg === 'send_data') {
// 可以发送训练数据
this.getPreviewCommand()
}
},
startGetImg () {
startGetImg() {
this.timeImg = setInterval(() => {
this.PyApi(22, [this.wsData.data[1], this.wsData.data[3], this.wsData.data[37]])
}, 10000);
}, 10000)
}
}
}
</script>
<style scoped>
</style>
......@@ -64,6 +64,7 @@ export default {
this.getDataList()
if (this.isCopy) {
this.form.modelEstimateDto = { ...this.item }
this.form.modelEstimateDto.datasetVersionIds = this.item.datasetVersionIds
} else if (this.modelVersionId) {
this.form.modelEstimateDto.modelVersionId = this.modelVersionId
}
......
......@@ -146,48 +146,51 @@ export default {
},
onmessage(data) {
console.log(data)
// let nowChat = this.myHistory[this.myHistory.length - 1]
// if (this.chatForm.pattern === 0) {
// // 通用智能问答
// // data = data.replace(/^data:\s+|\s+$/g, '')
// nowChat.excludeReferenceAnswer += data
// nowChat.answer += data
// } else if (this.chatForm.pattern === 1) {
// // 专业知识库问答
// // console.log(data)
// let temporary = JSON.parse(`[${data}]`.replace(/}{/g, '},{'))
// temporary.forEach((item) => {
// this.modifyContent(item) // 修改返回内容
// nowChat.excludeReferenceAnswer += item.answer || '' // 排除回答中的引用内容
// nowChat.answer += item.answer || '\n' + item.docs
// })
// } else if (this.chatForm.pattern === 2) {
// // 搜索引擎问答
// } else if (this.chatForm.pattern === 3) {
// // 基于文件问答
// let temporary = JSON.parse(`[${data}]`.replace(/}{/g, '},{'))
// temporary.forEach((item) => {
// this.modifyContent(item) // 修改返回内容
// nowChat.excludeReferenceAnswer += item.answer || '' // 排除回答中的引用内容
// nowChat.answer += item.answer || '\n' + item.docs
// })
// } else if (this.chatForm.pattern === 4) {
// let temporary = JSON.parse(`[${data}]`.replace(/}{/g, '},{'))
let nowChat = this.myHistory[this.myHistory.length - 1]
if (this.chatForm.pattern === 0) {
let temporary = JSON.parse(`[${data}]`.replace(/}{/g, '},{'))
// 通用智能问答
// data = data.replace(/^data:\s+|\s+$/g, '')
// nowChat.excludeReferenceAnswer += data.answer
// nowChat.answer += data.answer
temporary.forEach((item) => {
this.modifyContent(item) // 修改返回内容
nowChat.excludeReferenceAnswer += item.answer || '' // 排除回答中的引用内容
nowChat.answer += item.answer || '\n' + (item.docs || '')
})
} else if (this.chatForm.pattern === 1) {
// 专业知识库问答
// console.log(data)
let temporary = JSON.parse(`[${data}]`.replace(/}{/g, '},{'))
temporary.forEach((item) => {
this.modifyContent(item) // 修改返回内容
nowChat.excludeReferenceAnswer += item.answer || '' // 排除回答中的引用内容
nowChat.answer += item.answer || '\n' + (item.docs || '')
})
} else if (this.chatForm.pattern === 2) {
// 搜索引擎问答
} else if (this.chatForm.pattern === 3) {
// 基于文件问答
let temporary = JSON.parse(`[${data}]`.replace(/}{/g, '},{'))
// temporary.forEach((item) => {
// console.log(item)
// this.modifyContent(item) // 修改返回内容
// nowChat.excludeReferenceAnswer += item.answer || '' // 排除回答中的引用内容
// nowChat.answer += item.answer || '\n' + item.docs.join()
// // nowChat.answer += item.answer += '\n' + item.docs.join()
// })
// }
temporary.forEach((item) => {
this.modifyContent(item) // 修改返回内容
nowChat.excludeReferenceAnswer += item.answer || '' // 排除回答中的引用内容
nowChat.answer += item.answer || '\n' + (item.docs || '')
})
} else if (this.chatForm.pattern === 4) {
let temporary = JSON.parse(`[${data}]`.replace(/}{/g, '},{'))
temporary.forEach((item) => {
this.modifyContent(item) // 修改返回内容
nowChat.excludeReferenceAnswer += item.answer || '' // 排除回答中的引用内容
nowChat.answer += item.answer || '\n' + (item.docs.join() || '')
// nowChat.answer += item.answer += '\n' + item.docs.join()
})
}
// this.$nextTick(() => {
// this.$refs.contentBox.scrollTo(0, this.$refs.contentBox.scrollHeight)
// })
this.$nextTick(() => {
this.$refs.contentBox.scrollTo(0, this.$refs.contentBox.scrollHeight)
})
},
modifyContent(item) {
// 修改返回内容
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment