Commit 58e92a77 by 陈宥希

initial

parents
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# demo
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "demo",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"axios": "^1.4.0",
"core-js": "^3.32.1",
"element-plus": "^2.3.9",
"vue": "^3.3.4",
"vue-router": "^4.2.4"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"less": "^4.2.0",
"less-loader": "^8.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead",
"not ie 11"
]
}
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>话术审核</title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
<template>
<router-view/>
</template>
<style lang="less">
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
width: 100%;
height: 100%;
}
</style>
/**
* Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)
* http://cssreset.com
*/
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
font-weight: normal;
vertical-align: baseline;
box-sizing: border-box;
}
/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
display: block;
}
ol,
ul,
li {
list-style: none;
}
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/* custom */
a {
color: #7e8c8d;
text-decoration: none;
-webkit-backface-visibility: hidden;
}
::-webkit-scrollbar-track-piece {
background-color: rgba(0, 0, 0, 0.2);
-webkit-border-radius: 6px;
}
::-webkit-scrollbar-thumb:vertical {
height: 5px;
background-color: rgba(125, 125, 125, 0.7);
-webkit-border-radius: 6px;
}
::-webkit-scrollbar-thumb:horizontal {
width: 5px;
background-color: rgba(125, 125, 125, 0.7);
-webkit-border-radius: 6px;
}
html,
body {
width: 100%;
font-family: "Arial", "Microsoft YaHei", "黑体", "宋体", "微软雅黑", sans-serif;
min-height: 100%;
}
body {
line-height: 1;
-webkit-text-size-adjust: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
/*清除浮动*/
.clearfix::before {
content: " ";
display: inline-block;
clear: both;
}
.clearfix {
*zoom: 1;
}
/*隐藏*/
.dn {
display: none;
}
div {
box-sizing: border-box;
}
/* 超小设备 (手机, 600px 以下屏幕设备) */
@media only screen and (max-width: 600px) {
html {
font-size: 12px;
}
}
/* 小设备 (平板电脑和大型手机,600 像素及以上) */
@media only screen and (min-width: 600px) {
html {
font-size: 15px;
}
}
/* 中型设备(平板电脑,768 像素及以上) */
@media only screen and (min-width: 768px) {
html {
font-size: 18px;
}
}
/* 大型设备(笔记本电脑/台式机,992 像素及以上) */
@media only screen and (min-width: 992px) {
html {
font-size: 24px;
}
}
/* 超大型设备(大型笔记本电脑和台式机,1200 像素及以上) */
@media only screen and (min-width: 1200px) {
html {
font-size: 37.5px;
}
}
.tableHeaders > .cell {
font-size: .45rem;
text-align: center !important;
}
\ No newline at end of file
/**
* 格式化时间
* @param {*} value 需要处理的时间
* @param {Boolean} str 時間戳格式化,默认为false
*/
export const formatDate = (value, str = false, chinese = false) => {
let date = new Date(value)
let y = date.getFullYear()
let MM = date.getMonth() + 1
MM = MM < 10 ? ('0' + MM) : MM
let d = date.getDate()
d = d < 10 ? ('0' + d) : d
let h = date.getHours()
h = h < 10 ? ('0' + h) : h
let m = date.getMinutes()
m = m < 10 ? ('0' + m) : m
let s = date.getSeconds()
s = s < 10 ? ('0' + s) : s
if (str) {
return y + '-' + MM + '-' + d
} else {
if (chinese) {
return y + '年' + MM + '月' + d + '日 ' + h + ':' + m + ':' + s
}
return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s
}
}
\ No newline at end of file
<script setup>
import {onMounted, shallowReactive, ref} from 'vue';
defineProps({
value: Number
})
const emit = defineEmits(['handleAddCount']);
</script>
<template>
<h1>{{ value }}</h1>
<button @click="emit('handleAddCount')">点击+1</button>
</template>
\ No newline at end of file
import {createApp} from 'vue';
import App from './App.vue';
import router from './router';
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import './assets/css/reset.css';
const app = createApp(App);
app.use(ElementPlus);
app.use(router);
app.mount('#app');
import axios from "axios";
import router from "@/router/index.js";
import {ElMessage} from "element-plus";
/**重置message,防止重复点击重复弹出message弹框 */
let messageInstance = null;
const resetMessage = (options) => {
if (messageInstance) {
messageInstance.close();
}
messageInstance = ElMessage(options);
};
['error', 'success', 'info', 'warning'].forEach(type => {
resetMessage[type] = options => {
if (typeof options === 'string') {
options = {
message: options
}
}
options.type = type;
return resetMessage(options);
}
});
export const Message = resetMessage;
// 请求超时时间
axios.defaults.timeout = 10000;
// post请求头
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
// 请求拦截器
axios.interceptors.request.use(
config => {
// 每次发送请求之前判断是否存在token,如果存在,则统一在http请求的header都加上token,不用每次请求都手动添加了
// 即使本地存在token,也有可能token是过期的,所以在响应拦截器中要对返回状态进行判断
const mid = window.localStorage.getItem('token');
const token = mid ? mid : '';
const str = "Basic " + btoa(mid + ":" + "s00pers3cret");
token && (config.headers.Authorization = str);
// console.log(config.url)
// const chatBot = config.url.includes('/api/cc/chat/single/bot');
// if (chatBot) {
// axios.defaults.headers.post['Content-Type'] = 'application/json;charset=utf-8';
// }
// 对用户状态进行判断、记录登录、注册的时间
// if(config.url === "/ploteditor/login" || config.url === "/ploteditor/registered"){
// window.localStorage.setItem('oldTime',new Date().getTime())
// }else{
// const newTime = new Date().getTime()
// const oldTime = window.localStorage.getItem('oldTime')
// if(newTime - oldTime > 120000){
// Message({
// message: '登录过期,请重新登录',
// duration: 1000,
// forbidClick: true
// });
// setTimeout(() => {
// router.replace({
// path: "/",
// });
// }, 500);
// return Promise.error(error);
// }else{
// window.localStorage.setItem('oldTime',newTime)
// }
// }
return config;
},
error => {
return Promise.error(error);
}
);
// 响应拦截器
axios.interceptors.response.use(
response => {
// 如果返回的状态码为200,说明接口请求成功,可以正常拿到数据。否则的话抛出错误
// console.log(response);
if (response.status === 200) {
if (response.data.code !== 1) {
if (response.data.code === 20007) {
return Promise.resolve(response);
} else {
return Promise.resolve(response);
}
}
return Promise.resolve(response);
} else {
return Promise.reject(response);
}
},
// 服务器状态码不是200的情况
error => {
if (error.response.status) {
switch (error.response.status) {
case 401:
break;
case 403:
break;
case 404:
break;
default:
}
return Promise.reject(error.response);
}
}
);
/**
* get方法,对应get请求
* @param {String} url [请求的url地址]
*/
export function get(url) {
return new Promise((resolve, reject) => {
axios.get(url)
.then(res => {
resolve(res.data);
}).catch(err => {
reject(err.data);
});
});
}
/**
* post方法,对应post请求 默认Content-Type为JSON
* @param {String} url [请求的url地址]
* @param {Object} params [请求时携带的参数]
*/
export function post(url, params) {
return new Promise((resolve, reject) => {
axios.post(url, params, {headers: {'Content-Type': 'application/json'}})
.then(res => {
resolve(res.data);
}).catch(err => {
reject(err.data);
});
});
}
/**
* put方法,对应put请求
* @param {String} url [请求的url地址]
* @param {Object} params [请求时携带的参数]
*/
export function put(url, params) {
return new Promise((resolve, reject) => {
axios.put(url, params, {headers: {'Content-Type': 'application/json'}})
.then(res => {
resolve(res.data);
}).catch(err => {
reject(err.data);
});
});
}
/**
* delete方法,对应delete请求
* @param {String} url [请求的url地址]
*/
export function handleDel(url, params) {
return new Promise((resolve, reject) => {
axios.delete(url)
.then(res => {
resolve(res.data);
}).catch(err => {
reject(err.data);
});
});
}
\ No newline at end of file
// export const baseUrl = 'https://tongyong-pre.jiaoyou365.com';
// export const baseUrl = 'https://tongyong.jiaoyou365.com';
// export const baseUrl = 'http://localhost:47001';
export const baseUrl = 'http://tx-gz18.heyqiwu.cn';
// TODO 不使用https;前端,baseUrl需为远程地址,打包时记得修改
// GET https://localhost:47001/api/audit/getAuditData?searchText=&auditStatus=&pageSize=10&pageNum=1&sortMethod=
// net::ERR_SSL_PROTOCOL_ERROR
\ No newline at end of file
import {get, put, post} from './axios.js';
import {baseUrl} from './baseUrl.js';
import {handleError} from "vue";
// import {post} from "axios";
/**
* 查询数据 查询参数以URL参数形式
* @param {*} param
*/
export const getData = (param) => {
// Test
console.log(param);
try {
return get(baseUrl + '/api/audit/getAuditData?' + param);
} catch (e) {
console.log(e);
return {msg: "failed"};
}
}
export const postForKnownBots = () => {
return post(baseUrl + '/api/pregen/getKnownBots', null);
}
/**
* 修改状态 查询参数在请求体中
* @param {*} param 修改后的话语-回答数据
*/
export const putAuditData = (param) => {
return put(baseUrl + '/api/audit/putAuditData', param);
}
/**
* 删除回答 查询参数在请求体中
* @param {*} param 修改后的话语-回答数据
*/
export const postDeleteData = (param) => {
return post(baseUrl + '/api/audit/deleteReply', param);
}
/**
* 重新生成回答 查询参数在请求体中
*/
export const postGenerateOneData = (param) => {
return post(baseUrl + '/api/pregen/generateOne', param);
}
\ No newline at end of file
import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router'
import IndexView from '../views/IndexView.vue'
const routes = [
{
path: '/', // '/index',
name: 'IndexView',
component: IndexView
}
]
const router = createRouter({
history: createWebHashHistory(), // “/#/”
routes: routes // 可简写为 routes
})
export default router
const { defineConfig } = require('@vue/cli-service');
module.exports = defineConfig({
transpileDependencies: true,
publicPath:'./',
devServer: {
//代理axios
// proxy: 'http://localhost:9000',
//vue自己启动的端口
port: 47002
}
});
// const proxy = require('http-proxy-middleware');
// // 服务器会将任何未知请求 (没有匹配到静态文件的请求) 代理到http://localhost:9000上
# 对话模型及审核
# 对话模型及审核
**测试环境URL**: https://tongyong-pre.jiaoyou365.com
**生产环境URL**: https://tongyong.jiaoyou365.com
##查询
**METHOD**: GET
**path**: /api/chat/audit/info
## 公共请求实例
```json
curl --location 'https://******/api/chat/audit/info?searchText=null&auditStatus=null&pageSize=1&pageNum=10'
```
## 公共响应实例
```json
{
"code": 1,
"msg": "成功",
"data": {
"pages": 19,
"pageNum": 10,
"pageSize": 1,
"total": 19,
"records": [
{
"id": 10,
"workName": "机器男友",
"plotInfo": "【罗伯特是个高度拟人化的机器人,罗伯特的设定是你的温柔体贴的男友,在你起床的时候】【罗伯特对你说:】你起床了,昨晚睡得怎么样?【你回复罗伯特:】好累呀【罗伯特要说服你去散步,以罗伯特的口吻简短回复这句话】",
"answer": "你现在感觉如何?要不要去散步?",
"modelChannel": "minimax",
"auditStatus": 1, // 0未审核,1审核通过,2审核不通过
"gmtCreate": "2023-04-11T12:23:01.700+00:00",
"gmtModified": "2023-04-11T12:23:01.700+00:00"
},
{ ... }
]
}
}
```
##修改
**METHOD**: PUT
**path**: /api/chat/audit/info
## 公共请求实例
```json
curl --location --request PUT 'https://127.0.0.1:48088/api/chat/audit/info' \
--header 'Content-Type: application/json' \
--data '{
"answer":"散步是一种很好的恢复精力的方式。让我们去呼吸新鲜空气,享受户外的美好吧!",
"auditStatus":1,
"id":1,
"plotInfo":"【罗伯特是个高度拟人化的机器人,罗伯特的设定是你的温柔体贴的男友,在你起床的时候】【罗伯特对你说:】你起床了,昨晚睡得怎么样?【你回复罗伯特:】好累呀【罗伯特要说服你去散步,以罗伯特的口吻简短回复这句话】",
"workName":"机器男友"
}'
```
## 公共响应实例
```json
{
"code": 1,
"msg": "成功",
"data": {
"pages": 19,
"pageNum": 10,
"pageSize": 1,
"total": 19,
"records": [
{
"id": 10,
"workName": "机器男友",
"plotInfo": "【罗伯特是个高度拟人化的机器人,罗伯特的设定是你的温柔体贴的男友,在你起床的时候】【罗伯特对你说:】你起床了,昨晚睡得怎么样?【你回复罗伯特:】好累呀【罗伯特要说服你去散步,以罗伯特的口吻简短回复这句话】",
"answer": "你现在感觉如何?要不要去散步?",
"modelChannel": "minimax",
"auditStatus": 1,
"gmtCreate": "2023-04-11T12:23:01.700+00:00",
"gmtModified": "2023-04-11T12:23:01.700+00:00"
},
{ ... }
]
}
}
```
\ No newline at end of file
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