Commit 93b74234 authored by 高飞's avatar 高飞

修改新技术模块

parent ba57cf80
import { post_machineWriting } from "../util/http_util";
//命名实体识别 api_technique_entity
//热词 api_technique_hotWord
//消息摘要算法 api_technique_summary
//情感 api_technique_emotion
//命名实体识别
export const getProblemResult = data => {
return post_machineWriting(`api_machineWriting/api/gpu/gewu_api/chatbot/gewu`, data);
}
\ No newline at end of file
......@@ -701,6 +701,36 @@ let post_technique_entity = (url, data, headers = {}) => {
}).catch(err => reject(err));
})
};
let post_machineWriting = (url, data, headers = {}) => {
return new Promise((resolve, reject) => {
fetch(url, {
method: "POST",
body: typeof data == "object" ? JSON.stringify(data) : data,
headers:
{
'apiKey':'7838fab88cde479d84d710d3d2453276',
'Content-Type': 'application/json'
}
}).then(res => {
if (res.status == 200) {
return res.text();
} else {
console.log(res.statusText);
reject(HTTP_STATUS);
}
}).then(res => {
let result = JSON.parse(res);
if (result.success) {
// resolve(JSON.parse(result.data));
resolve(result.mode);
} else {
reject(result);
}
})
.catch(err => reject(err));
})
}
export {
......@@ -740,5 +770,6 @@ export {
post_technique_entity,
addParamNew,
arr_img_format,
fileUploadProgress
fileUploadProgress,
post_machineWriting
}
\ No newline at end of file
<template>
<el-dialog title="机器写作" :visible.sync="dialogVisible" width="60%" :before-close="handleClose" :close-on-click-modal="false">
<div class="info-messageInfo">
<div class="messageInfo-content">
<div id="chatContent" class="chatContent" ref="chatContent">
<div v-for="item in chatMessageList" class="everyMessage">
<div :style="{ justifyContent: item.type == 1 ? 'flex-end' : 'flex-start' }">
<template v-if="item.type==2">
<!-- <img class="otherSidesAvatarImg" :src="avatar" alt=""> -->
<div class="otherSides">
<!-- <div class="otherSides-user">{"机器"}</div> -->
<div class="otherSides-text" v-html="item.message"
style="background-color: white;" v-if="item.message!=''">
</div>
<i class="el-icon-loading" style="color:white" v-else></i>
</div>
</template>
<template v-else>
<div class="mySides-text" v-html="item.message"
style="background-color: #85ce61;">
</div>
</template>
</div>
</div>
</div>
<div class="chatSendMessage">
<div class="messageContent">
<!-- <div ref="editor" class="preview" contenteditable @keyup.enter="handleSubmit"></div> -->
<!-- onpaste="this.value=this.value.replace(/\r|\n/ig,'')" onkeyup="this.value=this.value.replace(/\r|\n/ig,'')" -->
<el-input ref="inputs" :disabled="disableds" style="border: 1px solid #6d6d6d;" type="textarea" autosize @keyup.native="handleSubmit($event)" placeholder="请输入内容回车搜索" v-model="sendMessage" >
</el-input>
</div>
<div class="sendMessageButtonList">
<el-button size="mini" type="success" @click="sendMessageFn" :disabled="disableds">发送</el-button>
</div>
</div>
</div>
</div>
</el-dialog>
</template>
<script>
import avatar from '../../../assets/img/ddkz/headPhoto.jpg';
import { getProblemResult } from '../../../api/machineWriting';
export default {
data() {
return {
dialogVisible: false,
chatMessageList: [],
sendMessage:'',
historyList:[],
avatar: avatar,
disableds:false,
}
},
props: {
visible: Boolean
},
methods: {
handleClose() {
this.$emit('handleCancel');
},
sendMessageFn(){
if(!this.disableds){
this.chatMessageList.push({type:1,message:this.sendMessage})
this.chatMessageList.push({type:2,message:''});
this.queryResult(this.sendMessage)
this.sendMessage = '';
}
},
queryResult(text){
this.$nextTick(() => {
this.keepBottom();
});
this.disableds = true;
getProblemResult({
text:text,
top_p:0.8,
temperature:0.85,
history:this.historyList
}).then((res)=>{
this.historyList.push({human:text,bot:res});
this.chatMessageList[this.chatMessageList.length-1].message = res;
this.$nextTick(() => {
this.keepBottom();
});
this.disableds = false;
}).catch(err=>{
console.log(err);
this.disableds = false;
})
},
handleSubmit(event){
if (event.keyCode == 13) {
if (!event.ctrlKey) {
event.preventDefault();
this.sendMessageFn();
} else {
this.sendMessage += '\n';
}
}
},
keepBottom() {
this.$refs.chatContent.scrollTop = this.$refs.chatContent.scrollHeight;
},
},
mounted() {
this.dialogVisible = this.$props.visible;
},
watch:{
disableds: function (val) {
if(!val){
this.$nextTick((_) => {
this.$refs.inputs.focus();
})
}
}
}
}
</script>
<style lang="scss">
.el-dialog {
padding: 20px;
box-sizing: border-box;
background-color: transparent;
background-image: url(../../../assets/img/home/dialog.png);
background-size: 100% 100%;
background-repeat: no-repeat;
.info-messageInfo {
width: 100%;
height: 60%;
.title {
width: 100%;
height: 30px;
line-height: 30px;
img {
width: 20px;
height: 20px;
}
span {
font-size: 16px;
font-weight: 500;
color: white;
vertical-align: text-bottom;
}
}
.messageInfo-content {
width: 100%;
height: calc(100% - 40px);
margin-top: 10px;
padding: 0px 10px;
border: 1px solid #515151c9;
box-sizing: border-box;
.chatContent {
width: 100%;
height: 74%;
border-bottom: 1px solid #37383f;
padding: 10px 0px;
box-sizing: border-box;
overflow-y: auto;
.everyMessage {
width: 100%;
margin-top: 10px;
&>div {
width: 100%;
display: flex;
align-items: flex-start;
margin-top: 10px;
font-size: 13px;
.otherSidesAvatarImg {
width: 20px;
height: 20px;
margin: 5px 10px 0px 10px;
}
.mySidesAvatarImg {
width: 20px;
height: 20px;
margin: 0px 10px;
}
&>div {
max-width: 50%;
.otherSides-user {
color: white;
margin-bottom: 5px;
}
.otherSides-text {
border-radius: 5px;
color: black;
margin-bottom: 5px;
padding: 5px 10px;
}
.el-imgage {
img {
width: 100%;
height: 100%;
}
}
}
.mySides-text {
border-radius: 5px;
color: black;
margin-bottom: 5px;
padding: 5px 10px;
}
}
}
}
.chatSendMessage {
width: 100%;
height: 25%;
position: relative;
.messageContent {
width: 100%;
height: 100%;
padding: 5px 0px;
box-sizing: border-box;
.preview {
width: 100%;
height: 100%;
padding: 10px;
box-sizing: border-box;
color: white;
border: 1px solid #474748;
outline: none;
/* 隐藏聚焦时外边框 */
white-space: pre-wrap;
overflow: hidden;
overflow-y: auto;
word-break: break-all;
}
.el-textarea__inner {
height: 100% !important;
color: white !important;
background-color: transparent !important;
border: 1px solid #37383f !important;
}
}
.sendMessageButtonList {
position: absolute;
right: 10px;
bottom: 15px;
}
}
}
}
}
</style>
\ No newline at end of file
......@@ -35,8 +35,8 @@ export default {
techniqueList: [
{ label: "命名实体识别", value: 1 },
{ label: "热词", value: 2 },
{ label: "消息摘要算法", value: 3 },
{ label: "情感识别", value: 4 },
// { label: "消息摘要算法", value: 3 },
{ label: "多模态智能心理分析技术", value: 4 },
]
}
},
......
......@@ -115,13 +115,13 @@
:src="item" :preview-src-list="obj_xq.fileUrlList" :key="item">
</el-image>
</div>
<div class="titles-div">
<!-- <div class="titles-div">
<div class="bgs-div"></div>
<div class="bgs-span">
<span>简介</span>
<span>基础概述</span>
</div>
</div>
<div class="content-divs" v-html="obj_xq.briefIntroduction"></div>
<div class="content-divs" v-html="obj_xq.content"></div> -->
<div class="titles-div">
<div class="bgs-div"></div>
<div class="bgs-span">
......@@ -164,12 +164,13 @@
</div>
</transition>
<NewTechniqueDialog v-if="visible" :visible="visible" :type="obj_xq.type" @handleCancel="closeDialog"></NewTechniqueDialog>
<MachineWriting v-if="visibleMachineWriting" :visible="visibleMachineWriting" @handleCancel="closeDialogMachineWriting"></MachineWriting>
</div>
</template>
<script>
import VanillaTilt from "vanilla-tilt";
import "animate.css";
import MachineWriting from '../xjssy/components/machineWriting.vue';
import NewTechniqueDialog from '../xjssy/components/newTechniqueDialog.vue';
export default {
data() {
......@@ -216,26 +217,22 @@ export default {
},
{
type: 3,
title: "消息摘要算法",
subtitle: "计算机科学术语",
content: "消息摘要算法的主要特征是加密过程不需要密钥,并且经过加密的数据无法被解密,可以被解密逆向的只有CRC32算法,只有输入相同的明文数据经过相同的消息摘要算法才能得到相同的密文。",
briefIntroduction: `消息摘要算法不存在密钥的管理与分发问题,适合于分布式网络上使用。由于其加密计算的工作量相当可观,所以以前的这种算法通常只用于数据量有限的情况下的加密,例如计算机的口令就是用不可逆加密算法加密的。近年来,随着计算机性能的飞速改善,加密速度不再成为限制这种加密技术发展的桎梏,因而消息摘要算法应用的领域不断增加。<br/>
消息摘要算法主要应用在“数字签名”领域,作为对明文的摘要算法。著名的摘要算法有RSA公司的MD5算法和SHA-1算法及其大量的变体。`,
title: "机器写作",
subtitle: "智能辅助",
content: "机器写作是一种利用人工智能技术,如机器学习、自然语言处理等,来生成文本的技术。这种技术可以用于各种领域,如新闻写作、博客文章、学术论文、商业报告等。机器写作的主要目标是提高写作效率和质量,减少人工错误,并使作者能够专注于创作过程",
features: `
<h3>消息摘要算法的特点:</h3>
消息摘要是把任意长度的输入揉和而产生长度固定的伪随机输出的算法。消息摘要的主要特点有:<br/>
&emsp;&emsp;①无论输入的消息有多长,计算出来的消息摘要的长度总是固定的。例如应用MD5算法摘要的消息有128个比特位,用SHA-1算法摘要的消息最终有160比特位的输出,SHA-1的变体可以产生192比特位和256比特位的消息摘要。一般认为,摘要的最终输出越长,该摘要算法就越安全。<br/>
&emsp;&emsp;②消息摘要看起来是“随机的”。这些比特看上去是胡乱的杂凑在一起的。可以用大量的输入来检验其输出是否相同,一般,不同的输入会有不同的输出,而且输出的摘要消息可以通过随机性检验。但是,一个摘要并不是真正随机的,因为用相同的算法对相同的消息求两次摘要,其结果必然相同;而若是真正随机的,则无论如何都是无法重现的。因此消息摘要是“伪随机的”。<br/>
&emsp;&emsp;③一般地,只要输入的消息不同,对其进行摘要以后产生的摘要消息也必不相同;但相同的输入必会产生相同的输出。这正是好的消息摘要算法所具有的性质:输入改变了,输出也就改变了;两条相似的消息的摘要确不相近,甚至会大相径庭。<br/>
&emsp;&emsp;④消息摘要函数是无陷门的单向函数,即只能进行正向的信息摘要,而无法从摘要中恢复出任何的消息,甚至根本就找不到任何与原信息相关的信息。当然,可以采用强力攻击的方法,即尝试每一个可能的信息,计算其摘要,看看是否与已有的摘要相同,如果这样做,最终肯定会恢复出摘要的消息。但实际上,要得到的信息可能是无穷个消息之一,所以这种强力攻击几乎是无效的。<br/>
&emsp;&emsp;⑤好的摘要算法,没有人能从中找到“碰撞”,虽然“碰撞”是肯定存在的。即对于给定的一个摘要,不可能找到一条信息使其摘要正好是给定的。或者说,无法找到两条消息,使它们的摘要相同。
<h3>高效性</h3>
&emsp;&emsp;机器写作可以大大提高写作效率。通过使用机器学习和自然语言处理技术,机器可以快速生成高质量的文本。这使得机器写作非常适合于需要大量写作的任务,如新闻写作、博客文章、学术论文和商业报告等。
<h3>准确性</h3>
&emsp;&emsp;机器写作可以确保生成的文本的准确性。通过使用大量的训练数据和先进的算法,机器可以学习到如何生成准确、连贯和专业的文本。这使得机器写作非常适合于需要高质量文本的任务,如学术研究和商业报告等。
<h3>一致性</h3>
&emsp;&emsp;机器写作可以确保生成的文本的一致性。无论何时何地,只要使用相同的输入和参数,机器都会生成相同的输出。这使得机器写作非常适合于需要一致文本的任务,如新闻报道和博客文章等。
`,
fileUrlList: ['../../../static/file/messageDigestAlgorithm/messageDigestAlgorithm.webp']
fileUrlList: ['../../../static/file/jqxz/jqxz.jpg']
},
{
type: 4,
title: "情感识别",
title: "多模态智能心理分析技术",
subtitle: "计算机对人情感状态进行的识别",
content: "计算机对从传感器采集来的信号进行分析和处理,从而得出对方(人)正处在的情感状态,这种行为叫做情感识别。从生理心理学的观点来看,情绪是有机体的一种复合状态,既涉及体验又涉及生理反应,还包含行为,其组成分至少包括情绪体验、情绪表现和情绪生理三种因素。对于情感识别有两种方式,一种是检测生理信号如呼吸、心律和体温等,另一种是检测情感行为如面部特征表情识别、语音情感识别和姿态识别。",
summarize: `
......@@ -253,11 +250,13 @@ export default {
},
],
obj_xq: {},
visible: false
visible: false,
visibleMachineWriting: false,
};
},
components: {
'NewTechniqueDialog': NewTechniqueDialog
'NewTechniqueDialog': NewTechniqueDialog,
'MachineWriting':MachineWriting,
},
// props: {
// clientDetails: {
......@@ -277,9 +276,16 @@ export default {
closeDialog() {
this.visible = false;
},
closeDialogMachineWriting() {
this.visibleMachineWriting = false;
},
startUsing() {
if(this.obj_xq&&this.obj_xq.title=='机器写作'){
this.visibleMachineWriting = true;
}else{
this.visible = true;
}
}
},
mounted() {
let _this = this;
......
......@@ -155,6 +155,12 @@ module.exports = {
pathRewrite: {
'^/api_technique_hotWord/': '/'
}
},
'/api_machineWriting/': {
target: 'http://152.136.126.203',
pathRewrite: {
'^/api_machineWriting/': '/'
}
}
}
}
......
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