|
@@ -7,14 +7,24 @@
|
|
|
<span>课程时间轴</span>
|
|
|
</div>
|
|
|
<div class="tt_i_box">
|
|
|
- <div class="tt_i_b_step" v-if="navList.length==1">
|
|
|
- <!-- 只有一个阶段 -->
|
|
|
- <span :style="{'background':taskCount>=index?'#3681FC':'#E0EAFB'}" v-for="(item,index) in navList[courseType].task"></span>
|
|
|
- </div>
|
|
|
- <div class="tt_i_b_step" v-if="navList.length>1">
|
|
|
- <!-- 多个阶段 -->
|
|
|
- <span :style="{'background':courseType>=index?'#3681FC':'#E0EAFB'}" v-for="(item,index) in navList"></span>
|
|
|
- </div>
|
|
|
+ <div class="tt_i_b_step" v-if="navList.length == 1">
|
|
|
+ <!-- 只有一个阶段 -->
|
|
|
+ <span
|
|
|
+ :style="{
|
|
|
+ background: taskCount >= index ? '#3681FC' : '#E0EAFB'
|
|
|
+ }"
|
|
|
+ v-for="(item, index) in navList[courseType].task"
|
|
|
+ ></span>
|
|
|
+ </div>
|
|
|
+ <div class="tt_i_b_step" v-if="navList.length > 1">
|
|
|
+ <!-- 多个阶段 -->
|
|
|
+ <span
|
|
|
+ :style="{
|
|
|
+ background: courseType >= index ? '#3681FC' : '#E0EAFB'
|
|
|
+ }"
|
|
|
+ v-for="(item, index) in navList"
|
|
|
+ ></span>
|
|
|
+ </div>
|
|
|
<!-- <img :src="require('../../../assets/icon/course/group.png')" /> -->
|
|
|
</div>
|
|
|
</div>
|
|
@@ -32,7 +42,14 @@
|
|
|
<div>提交人数</div>
|
|
|
<span>{{ isWorkStudent }}<span>人</span></span>
|
|
|
</div>
|
|
|
- <div class="tt_i_b_b_item" v-if="(this.$route.query.tcid || courseDetail.juri) && allStudent && complete!='-'">
|
|
|
+ <div
|
|
|
+ class="tt_i_b_b_item"
|
|
|
+ v-if="
|
|
|
+ (this.$route.query.tcid || courseDetail.juri) &&
|
|
|
+ allStudent &&
|
|
|
+ complete != '-'
|
|
|
+ "
|
|
|
+ >
|
|
|
<div>完成率</div>
|
|
|
<span>{{ complete }}<span>%</span></span>
|
|
|
</div>
|
|
@@ -47,11 +64,11 @@
|
|
|
</div>
|
|
|
<div class="tt_i_b_b_item">
|
|
|
<div>点赞数</div>
|
|
|
- <span>{{likeNum}}<span>个</span></span>
|
|
|
+ <span>{{ likeNum }}<span>个</span></span>
|
|
|
</div>
|
|
|
<div class="tt_i_b_b_item">
|
|
|
<div>评论数</div>
|
|
|
- <span>{{commentNum}}<span>条</span></span>
|
|
|
+ <span>{{ commentNum }}<span>条</span></span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -60,7 +77,7 @@
|
|
|
</div>
|
|
|
<div class="t_top" ref="chatRef">
|
|
|
<div class="t_t_chat" v-for="(item, index) in chatList" :key="index">
|
|
|
- <div class="t_t_c_user" v-if="item.content && item.content!='addAsk'">
|
|
|
+ <div class="t_t_c_user" v-if="item.content && item.content != 'addAsk'">
|
|
|
<div class="t_t_c_u_left">
|
|
|
<div class="t_t_c_u_l_content">{{ item.content }}</div>
|
|
|
<div class="t_t_c_u_l_time">{{ item.createtime }}</div>
|
|
@@ -69,7 +86,7 @@
|
|
|
<span>我</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="t_t_c_ai" v-if="item.content!='addAsk'">
|
|
|
+ <div class="t_t_c_ai" v-if="item.content != 'addAsk'">
|
|
|
<div class="t_t_c_a_left">
|
|
|
<el-avatar v-if="item.filename" :src="item.filename"></el-avatar>
|
|
|
<span v-else>Ai</span>
|
|
@@ -86,13 +103,23 @@
|
|
|
v-loading="item.loading"
|
|
|
v-html="item.aiContent"
|
|
|
></div>
|
|
|
- <div v-else v-for="i in pan(item.aiContent)">
|
|
|
+ <div
|
|
|
+ v-else
|
|
|
+ v-for="i in pan(item.aiContent)"
|
|
|
+ style="position: relative;"
|
|
|
+ class="d_t_c_a_r_c_img"
|
|
|
+ >
|
|
|
<img
|
|
|
style="width: 130px;height: 130px;object-fit: cover;"
|
|
|
:src="i.image"
|
|
|
alt=""
|
|
|
@click="previewImg(i.image)"
|
|
|
/>
|
|
|
+ <span class="download_image" @click.stop="download(i.image)">
|
|
|
+ <img
|
|
|
+ :src="require('../../../assets/icon/fileIcon/download.png')"
|
|
|
+ />
|
|
|
+ </span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div
|
|
@@ -112,9 +139,14 @@
|
|
|
<div class="t_t_c_a_r_time">{{ item.createtime }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="s_t_addAsk" v-if="item.content == 'addAsk'">
|
|
|
- <span v-for="item2 in item.aiContent" :key="item2.index" @click.stop="send(item2.label)">{{item2.label}}</span>
|
|
|
- </div>
|
|
|
+ <div class="s_t_addAsk" v-if="item.content == 'addAsk'">
|
|
|
+ <span
|
|
|
+ v-for="item2 in item.aiContent"
|
|
|
+ :key="item2.index"
|
|
|
+ @click.stop="send(item2.label)"
|
|
|
+ >{{ item2.label }}</span
|
|
|
+ >
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="t_bottom">
|
|
@@ -133,7 +165,7 @@
|
|
|
:disabled="loading || chatLoading"
|
|
|
v-loading="loading || chatLoading"
|
|
|
@keyup.enter.native="send()"
|
|
|
- placeholder="请在此输入您想了解的内容"
|
|
|
+ placeholder="请在此输入您想了解的内容"
|
|
|
class="t_b_i_left"
|
|
|
v-model="text"
|
|
|
></el-input>
|
|
@@ -141,10 +173,10 @@
|
|
|
<span></span>
|
|
|
</div> -->
|
|
|
</div>
|
|
|
- <div class="t_b_btn" @click="send()">
|
|
|
- <span v-if="(!loading && !chatLoading)"></span>
|
|
|
- <div v-else @click.stop="stopSend()">停止</div>
|
|
|
- </div>
|
|
|
+ <div class="t_b_btn" @click="send()">
|
|
|
+ <span v-if="!loading && !chatLoading"></span>
|
|
|
+ <div v-else @click.stop="stopSend()">停止</div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -161,22 +193,22 @@ export default {
|
|
|
type: Object,
|
|
|
default: () => {}
|
|
|
},
|
|
|
- navList:{
|
|
|
- type:Array,
|
|
|
- default:()=>[]
|
|
|
- },
|
|
|
- courseType:{
|
|
|
- type:Number,
|
|
|
- default:0
|
|
|
- },
|
|
|
- taskCount:{
|
|
|
- type:Number,
|
|
|
- default:0
|
|
|
- },
|
|
|
- worksStudent:{
|
|
|
- type:Array,
|
|
|
- default:()=>[]
|
|
|
- }
|
|
|
+ navList: {
|
|
|
+ type: Array,
|
|
|
+ default: () => []
|
|
|
+ },
|
|
|
+ courseType: {
|
|
|
+ type: Number,
|
|
|
+ default: 0
|
|
|
+ },
|
|
|
+ taskCount: {
|
|
|
+ type: Number,
|
|
|
+ default: 0
|
|
|
+ },
|
|
|
+ worksStudent: {
|
|
|
+ type: Array,
|
|
|
+ default: () => []
|
|
|
+ }
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -187,94 +219,102 @@ export default {
|
|
|
chatLoading: false,
|
|
|
chatList: [],
|
|
|
nowChatList: [],
|
|
|
- source:null,
|
|
|
- saveUid:"",
|
|
|
- allStudent:[],
|
|
|
- tcid:this.$route.query.tcid,
|
|
|
- oid:this.$route.query.oid,
|
|
|
+ source: null,
|
|
|
+ saveUid: "",
|
|
|
+ allStudent: [],
|
|
|
+ tcid: this.$route.query.tcid,
|
|
|
+ oid: this.$route.query.oid
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
- isWorkAll(){
|
|
|
- let _userList = []
|
|
|
- if(this.worksStudent.length){
|
|
|
- this.worksStudent.forEach(i=>{
|
|
|
- if(i.length){
|
|
|
- i.forEach(i2=>{
|
|
|
- if(i2.commentJson){
|
|
|
- i2.commentJson.forEach(i3=>{
|
|
|
- if(i3.userid && !_userList.find(i5=>i5.userid==i3.userid)){
|
|
|
- _userList.push(i3)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- if(i2.likeJson){
|
|
|
- i2.likeJson.forEach(i4=>{
|
|
|
- if(i4.likesId && !_userList.find(i5=>i5.userid==i4.likesId)){
|
|
|
- _userList.push({...i4,userid:i4.likesId})
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- return _userList.length;
|
|
|
- },
|
|
|
- complete(){
|
|
|
- let _result = 0;
|
|
|
- let _all = this.allStudent?this.allStudent.length:0
|
|
|
- if(_all==0)return '-'
|
|
|
- _result = ((this.isWorkStudent/_all).toFixed(2))*100
|
|
|
- return _result;
|
|
|
- },
|
|
|
- likeNum(){
|
|
|
- let _result = 0;
|
|
|
- if(this.worksStudent.length){
|
|
|
- this.worksStudent.forEach(i=>{
|
|
|
- if(i.length){
|
|
|
- i.forEach(i2=>{
|
|
|
- if(i2.likesCount){
|
|
|
- _result+=i2.likesCount
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- return _result;
|
|
|
- },
|
|
|
- commentNum(){
|
|
|
- let _result = 0;
|
|
|
- if(this.worksStudent.length){
|
|
|
- this.worksStudent.forEach(i=>{
|
|
|
- if(i.length){
|
|
|
- i.forEach(i2=>{
|
|
|
- if(i2.commentCount){
|
|
|
- _result+=i2.commentCount
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- return _result;
|
|
|
- },
|
|
|
- isWorkStudent(){
|
|
|
- let _userList = []
|
|
|
- if(this.worksStudent.length){
|
|
|
- this.worksStudent.forEach(i=>{
|
|
|
- if(i.length){
|
|
|
- i.forEach(i2=>{
|
|
|
- if(i2.ttype==2 && !_userList.find(i3=>i3.userid==i2.userid)){
|
|
|
- _userList.push(i2)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- return _userList.length;
|
|
|
- },
|
|
|
+ isWorkAll() {
|
|
|
+ let _userList = [];
|
|
|
+ if (this.worksStudent.length) {
|
|
|
+ this.worksStudent.forEach(i => {
|
|
|
+ if (i.length) {
|
|
|
+ i.forEach(i2 => {
|
|
|
+ if (i2.commentJson) {
|
|
|
+ i2.commentJson.forEach(i3 => {
|
|
|
+ if (
|
|
|
+ i3.userid &&
|
|
|
+ !_userList.find(i5 => i5.userid == i3.userid)
|
|
|
+ ) {
|
|
|
+ _userList.push(i3);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (i2.likeJson) {
|
|
|
+ i2.likeJson.forEach(i4 => {
|
|
|
+ if (
|
|
|
+ i4.likesId &&
|
|
|
+ !_userList.find(i5 => i5.userid == i4.likesId)
|
|
|
+ ) {
|
|
|
+ _userList.push({ ...i4, userid: i4.likesId });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return _userList.length;
|
|
|
+ },
|
|
|
+ complete() {
|
|
|
+ let _result = 0;
|
|
|
+ let _all = this.allStudent ? this.allStudent.length : 0;
|
|
|
+ if (_all == 0) return "-";
|
|
|
+ _result = ((this.isWorkStudent / _all) * 100).toFixed(2);
|
|
|
+ return _result;
|
|
|
+ },
|
|
|
+ likeNum() {
|
|
|
+ let _result = 0;
|
|
|
+ if (this.worksStudent.length) {
|
|
|
+ this.worksStudent.forEach(i => {
|
|
|
+ if (i.length) {
|
|
|
+ i.forEach(i2 => {
|
|
|
+ if (i2.likesCount) {
|
|
|
+ _result += i2.likesCount;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return _result;
|
|
|
+ },
|
|
|
+ commentNum() {
|
|
|
+ let _result = 0;
|
|
|
+ if (this.worksStudent.length) {
|
|
|
+ this.worksStudent.forEach(i => {
|
|
|
+ if (i.length) {
|
|
|
+ i.forEach(i2 => {
|
|
|
+ if (i2.commentCount) {
|
|
|
+ _result += i2.commentCount;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return _result;
|
|
|
+ },
|
|
|
+ isWorkStudent() {
|
|
|
+ let _userList = [];
|
|
|
+ if (this.worksStudent.length) {
|
|
|
+ this.worksStudent.forEach(i => {
|
|
|
+ if (i.length) {
|
|
|
+ i.forEach(i2 => {
|
|
|
+ if (
|
|
|
+ i2.ttype == 2 &&
|
|
|
+ !_userList.find(i3 => i3.userid == i2.userid)
|
|
|
+ ) {
|
|
|
+ _userList.push(i2);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return _userList.length;
|
|
|
+ },
|
|
|
pan() {
|
|
|
return content => {
|
|
|
try {
|
|
@@ -292,19 +332,18 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- stopSend(){
|
|
|
- if(this.source){
|
|
|
- this.source.close();
|
|
|
- if(this.chatList[this.chatList.length-1].content=='wanSearch'){
|
|
|
- this.chatList.pop();
|
|
|
- }
|
|
|
- this.loading = false;
|
|
|
- this.chatLoading = false;
|
|
|
- this.source = null;
|
|
|
- this.insertChat(this.saveUid)
|
|
|
-
|
|
|
- }
|
|
|
- },
|
|
|
+ stopSend() {
|
|
|
+ if (this.source) {
|
|
|
+ this.source.close();
|
|
|
+ if (this.chatList[this.chatList.length - 1].content == "wanSearch") {
|
|
|
+ this.chatList.pop();
|
|
|
+ }
|
|
|
+ this.loading = false;
|
|
|
+ this.chatLoading = false;
|
|
|
+ this.source = null;
|
|
|
+ this.insertChat(this.saveUid);
|
|
|
+ }
|
|
|
+ },
|
|
|
onCopy(content) {
|
|
|
// 创建临时textarea元素
|
|
|
const tempInput = document.createElement("textarea");
|
|
@@ -369,8 +408,10 @@ export default {
|
|
|
},
|
|
|
// 获取ai对话
|
|
|
getAiContent(_uid) {
|
|
|
- this.source = new EventSource(`https://claude3.cocorobo.cn/streamChat/${_uid}`);
|
|
|
- // this.source = new EventSource(`https://gpt4.cocorobo.cn/stream/${_uid}`); //http://gpt4.cocorobo.cn:8011/stream/ https://gpt4.cocorobo.cn/stream/
|
|
|
+ // this.source = new EventSource(
|
|
|
+ // `https://claude3.cocorobo.cn/streamChat/${_uid}`
|
|
|
+ // );
|
|
|
+ this.source = new EventSource(`https://gpt4.cocorobo.cn/stream/${_uid}`); //http://gpt4.cocorobo.cn:8011/stream/ https://gpt4.cocorobo.cn/stream/
|
|
|
let _allText = "";
|
|
|
let _mdText = "";
|
|
|
// const md = new MarkdownIt();
|
|
@@ -386,10 +427,10 @@ export default {
|
|
|
this.chatList.find(i => i.uid == _uid).isShowSynchronization = true;
|
|
|
this.chatList.find(i => i.uid == _uid).loading = false;
|
|
|
this.nowChatList.push(this.chatList.find(i => i.uid == _uid));
|
|
|
- let _content = this.chatList.find(i => i.uid == _uid).content;
|
|
|
- if(!['智能总结','智能出题','扩展知识'].includes(_content)){
|
|
|
- this.addAsk(this.chatList.find(i => i.uid == _uid).content);
|
|
|
- }
|
|
|
+ let _content = this.chatList.find(i => i.uid == _uid).content;
|
|
|
+ if (!["智能总结", "智能出题", "扩展知识"].includes(_content)) {
|
|
|
+ this.addAsk(this.chatList.find(i => i.uid == _uid).content);
|
|
|
+ }
|
|
|
// 这里保存对话
|
|
|
this.insertChat(_uid);
|
|
|
return;
|
|
@@ -417,7 +458,7 @@ export default {
|
|
|
},
|
|
|
//保存消息
|
|
|
insertChat(_uid) {
|
|
|
- if(_uid=='')return;
|
|
|
+ if (_uid == "") return;
|
|
|
let _data = this.chatList.find(i => i.uid == _uid);
|
|
|
if (!_data) return;
|
|
|
let params = {
|
|
@@ -432,7 +473,7 @@ export default {
|
|
|
filename: _data.filename,
|
|
|
session_name: `${this.courseId}-studyStudent-md` //这是对话记录位置
|
|
|
};
|
|
|
- this.saveUid = ""
|
|
|
+ this.saveUid = "";
|
|
|
this.ajax
|
|
|
.post("https://gpt4.cocorobo.cn/insert_chat", params)
|
|
|
.then(res => {});
|
|
@@ -532,52 +573,52 @@ export default {
|
|
|
return;
|
|
|
} else if (i.content == "getImage") {
|
|
|
return history.push({
|
|
|
- "role": "assistant",
|
|
|
- "content": i.aiContent
|
|
|
+ role: "assistant",
|
|
|
+ content: i.aiContent
|
|
|
});
|
|
|
}
|
|
|
if (i.content) {
|
|
|
history.push({
|
|
|
- "role": "user",
|
|
|
- "content": i.content
|
|
|
+ role: "user",
|
|
|
+ content: i.content
|
|
|
});
|
|
|
}
|
|
|
if (i.aiContent) {
|
|
|
history.push({
|
|
|
- "role": "assistant",
|
|
|
- "content": i.aiContent
|
|
|
+ role: "assistant",
|
|
|
+ content: i.aiContent
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
- history.push({ "role": "user", "content": _text });
|
|
|
+ history.push({ role: "user", content: _text });
|
|
|
// history.pop();
|
|
|
+ let params = {
|
|
|
+ model: "gpt-3.5-turbo",
|
|
|
+ temperature: 0,
|
|
|
+ max_tokens: 4096,
|
|
|
+ top_p: 1,
|
|
|
+ frequency_penalty: 0,
|
|
|
+ presence_penalty: 0,
|
|
|
+ messages: history,
|
|
|
+ uid: _uuid,
|
|
|
+ mind_map_question: _text
|
|
|
+ };
|
|
|
// let params = {
|
|
|
- // model: "gpt-3.5-turbo",
|
|
|
- // temperature: 0,
|
|
|
- // max_tokens: 4096,
|
|
|
- // top_p: 1,
|
|
|
- // frequency_penalty: 0,
|
|
|
- // presence_penalty: 0,
|
|
|
- // messages: history,
|
|
|
+ // message: {
|
|
|
+ // anthropic_version: "bedrock-2023-05-31",
|
|
|
+ // max_tokens: 4096,
|
|
|
+ // temperature: 0,
|
|
|
+ // top_p: 1,
|
|
|
+ // messages: history
|
|
|
+ // },
|
|
|
// uid: _uuid,
|
|
|
- // mind_map_question: _text
|
|
|
+ // model: "Claude 3 Sonnet" // Claude 3 Sonnet或者Claude 3 Haiku
|
|
|
// };
|
|
|
- let params = {
|
|
|
- message: {
|
|
|
- anthropic_version: "bedrock-2023-05-31",
|
|
|
- max_tokens: 4096,
|
|
|
- temperature: 0,
|
|
|
- top_p: 1,
|
|
|
- messages: history
|
|
|
- },
|
|
|
- uid: _uuid,
|
|
|
- model: "Claude 3 Sonnet" // Claude 3 Sonnet或者Claude 3 Haiku
|
|
|
- };
|
|
|
this.text = "";
|
|
|
|
|
|
this.ajax
|
|
|
- .post("https://claude3.cocorobo.cn/chat", params)
|
|
|
- // .post("https://gpt4.cocorobo.cn/chat", params)
|
|
|
+ // .post("https://claude3.cocorobo.cn/chat", params)
|
|
|
+ .post("https://gpt4.cocorobo.cn/chat", params)
|
|
|
.then(res => {
|
|
|
if (res.data.FunctionResponse.result == "发送成功") {
|
|
|
} else {
|
|
@@ -589,7 +630,7 @@ export default {
|
|
|
console.log(e);
|
|
|
this.chatLoading = false;
|
|
|
});
|
|
|
- this.saveUid = _uuid;
|
|
|
+ this.saveUid = _uuid;
|
|
|
this.getAiContent(_uuid);
|
|
|
},
|
|
|
sendType(_text) {
|
|
@@ -632,8 +673,8 @@ Instruction: Based on the context, follow "Format example", write content.
|
|
|
5. 环保教育活动:在学校中推广环保意识的活动和资源。
|
|
|
`;
|
|
|
} else if (_text == "智能出题") {
|
|
|
- // console.log("👇")
|
|
|
- // return console.log(this.navList[this.courseType].task[this.taskCount].taskName)
|
|
|
+ // console.log("👇")
|
|
|
+ // return console.log(this.navList[this.courseType].task[this.taskCount].taskName)
|
|
|
_msg = `
|
|
|
NOTICE
|
|
|
Language: Please use the same language as the user requirement, if the user speaks Chinese, the specific text of your answer should also be in Chinese.
|
|
@@ -670,7 +711,7 @@ Instruction: Based on the context, follow "Format example", write content.
|
|
|
|
|
|
|
|
|
`;
|
|
|
- console.log(_msg)
|
|
|
+ console.log(_msg);
|
|
|
} else if (_text == "智能总结") {
|
|
|
_msg = `
|
|
|
NOTICE
|
|
@@ -760,34 +801,34 @@ Instruction: Based on the context, follow "Format example", write content.
|
|
|
// history.push({ role: "user", content: _text });
|
|
|
this.scrollBottom();
|
|
|
|
|
|
+ let params = {
|
|
|
+ model: "gpt-3.5-turbo",
|
|
|
+ temperature: 0,
|
|
|
+ max_tokens: 4096,
|
|
|
+ top_p: 1,
|
|
|
+ frequency_penalty: 0,
|
|
|
+ presence_penalty: 0,
|
|
|
+ messages: history,
|
|
|
+ uid: _uuid,
|
|
|
+ mind_map_question: _text
|
|
|
+ };
|
|
|
// let params = {
|
|
|
- // model: "gpt-3.5-turbo",
|
|
|
- // temperature: 0,
|
|
|
- // max_tokens: 4096,
|
|
|
- // top_p: 1,
|
|
|
- // frequency_penalty: 0,
|
|
|
- // presence_penalty: 0,
|
|
|
- // messages: history,
|
|
|
+ // message: {
|
|
|
+ // anthropic_version: "bedrock-2023-05-31",
|
|
|
+ // max_tokens: 4096,
|
|
|
+ // temperature: 0,
|
|
|
+ // top_p: 1,
|
|
|
+ // messages: history
|
|
|
+ // },
|
|
|
// uid: _uuid,
|
|
|
- // mind_map_question: _text
|
|
|
+ // model: "Claude 3 Sonnet" // Claude 3 Sonnet或者Claude 3 Haiku
|
|
|
// };
|
|
|
- let params = {
|
|
|
- message: {
|
|
|
- anthropic_version: "bedrock-2023-05-31",
|
|
|
- max_tokens: 4096,
|
|
|
- temperature: 0,
|
|
|
- top_p: 1,
|
|
|
- messages: history
|
|
|
- },
|
|
|
- uid: _uuid,
|
|
|
- model: "Claude 3 Sonnet" // Claude 3 Sonnet或者Claude 3 Haiku
|
|
|
- };
|
|
|
this.text = "";
|
|
|
|
|
|
this.ajax
|
|
|
- .post("https://claude3.cocorobo.cn/chat", params)
|
|
|
+ // .post("https://claude3.cocorobo.cn/chat", params)
|
|
|
|
|
|
- // .post("https://gpt4.cocorobo.cn/chat", params)
|
|
|
+ .post("https://gpt4.cocorobo.cn/chat", params)
|
|
|
.then(res => {
|
|
|
if (res.data.FunctionResponse.result == "发送成功") {
|
|
|
} else {
|
|
@@ -799,12 +840,12 @@ Instruction: Based on the context, follow "Format example", write content.
|
|
|
console.log(e);
|
|
|
this.chatLoading = false;
|
|
|
});
|
|
|
- this.saveUid = _uuid;
|
|
|
+ this.saveUid = _uuid;
|
|
|
this.getAiContent(_uuid);
|
|
|
// this.send(text);
|
|
|
},
|
|
|
- addAsk(_text){
|
|
|
- this.chatLoading = true;
|
|
|
+ addAsk(_text) {
|
|
|
+ this.chatLoading = true;
|
|
|
let _uuid = uuidv4();
|
|
|
|
|
|
let _msg = `NOTICE
|
|
@@ -875,7 +916,7 @@ ${_text}
|
|
|
|
|
|
this.scrollBottom();
|
|
|
|
|
|
- let history = [];
|
|
|
+ let history = [];
|
|
|
// this.nowChatList.forEach(i => {
|
|
|
// if (i.content == "wanSearch") {
|
|
|
// // history.push({
|
|
@@ -890,7 +931,7 @@ ${_text}
|
|
|
// });
|
|
|
// }else if(i.content == "addAsk"){
|
|
|
|
|
|
- // }
|
|
|
+ // }
|
|
|
// if (i.content) {
|
|
|
// history.push({
|
|
|
// role: "user",
|
|
@@ -905,7 +946,7 @@ ${_text}
|
|
|
// }
|
|
|
// });
|
|
|
history.push({ role: "user", content: _msg });
|
|
|
- console.log(history)
|
|
|
+ console.log(history);
|
|
|
let params = {
|
|
|
model: "gpt-3.5-turbo",
|
|
|
temperature: 0,
|
|
@@ -913,8 +954,8 @@ ${_text}
|
|
|
top_p: 1,
|
|
|
frequency_penalty: 0,
|
|
|
presence_penalty: 0,
|
|
|
- messages:history,
|
|
|
- stream: false,
|
|
|
+ messages: history,
|
|
|
+ stream: false,
|
|
|
uid: _uuid,
|
|
|
mind_map_question: ""
|
|
|
};
|
|
@@ -935,43 +976,70 @@ ${_text}
|
|
|
.post("https://gpt4.cocorobo.cn/chat", params)
|
|
|
// .post("https://claude3.cocorobo.cn/chat", params)
|
|
|
.then(res => {
|
|
|
- console.log(res)
|
|
|
- let _data = res.data.FunctionResponse.choices[0].message.content;
|
|
|
- console.log(_data);
|
|
|
- this.chatList.find(i => i.uid == _uuid).aiContent =JSON.parse(_data);
|
|
|
- this.chatList.find(i => i.uid == _uuid).isalltext = true;
|
|
|
+ console.log(res);
|
|
|
+ let _data = res.data.FunctionResponse.choices[0].message.content;
|
|
|
+ console.log(_data);
|
|
|
+ this.chatList.find(i => i.uid == _uuid).aiContent = JSON.parse(_data);
|
|
|
+ this.chatList.find(i => i.uid == _uuid).isalltext = true;
|
|
|
this.chatList.find(i => i.uid == _uuid).isShowSynchronization = true;
|
|
|
this.chatList.find(i => i.uid == _uuid).loading = false;
|
|
|
- this.scrollBottom();
|
|
|
- this.chatLoading = false;
|
|
|
+ this.scrollBottom();
|
|
|
+ this.chatLoading = false;
|
|
|
})
|
|
|
.catch(e => {
|
|
|
this.chatLoading = false;
|
|
|
console.log(e);
|
|
|
});
|
|
|
- },
|
|
|
- getAllStudent(){
|
|
|
- let params = {
|
|
|
- oid:this.oid,
|
|
|
- cid:this.tcid?this.tcid:this.courseDetail.juri
|
|
|
- }
|
|
|
- this.allStudent = []
|
|
|
- this.ajax.get(this.$store.state.api+'selectWorksStudent',params).then(res=>{
|
|
|
- this.allStudent = res.data[0]
|
|
|
- })
|
|
|
- },
|
|
|
+ },
|
|
|
+ getAllStudent() {
|
|
|
+ let params = {
|
|
|
+ oid: this.oid,
|
|
|
+ cid: this.tcid ? this.tcid : this.courseDetail.juri
|
|
|
+ };
|
|
|
+ this.allStudent = [];
|
|
|
+ this.ajax
|
|
|
+ .get(this.$store.state.api + "selectWorksStudent", params)
|
|
|
+ .then(res => {
|
|
|
+ this.allStudent = res.data[0];
|
|
|
+ });
|
|
|
+ },
|
|
|
scrollBottom() {
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.chatRef.scrollTop = this.$refs.chatRef.scrollHeight;
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
+ download(_url) {
|
|
|
+ let xhr = new XMLHttpRequest();
|
|
|
+ xhr.open("GET", _url, true);
|
|
|
+ xhr.responseType = "blob";
|
|
|
+ xhr.onload = () => {
|
|
|
+ if (xhr.status === 200) {
|
|
|
+ let blob = xhr.response;
|
|
|
+ // const _blob = new Blob([blob], { type: fileType });
|
|
|
+ const downloadElement = document.createElement("a");
|
|
|
+ const url = window.URL.createObjectURL(blob);
|
|
|
+ downloadElement.href = url;
|
|
|
+ downloadElement.download = "Image.jpg";
|
|
|
+ downloadElement.click();
|
|
|
+ window.URL.revokeObjectURL(url); // 释放内存
|
|
|
+ }else{
|
|
|
+ this.$message.error("此图片不支持下载");
|
|
|
+ }
|
|
|
+ };
|
|
|
+ xhr.onerror = (e)=>{
|
|
|
+ console.log(e)
|
|
|
+ this.$message.error("此图片不支持下载");
|
|
|
+ }
|
|
|
+
|
|
|
+ xhr.send();
|
|
|
+
|
|
|
+ }
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getChatList().then(_ => {
|
|
|
this.scrollBottom();
|
|
|
});
|
|
|
- this.getAllStudent();
|
|
|
+ this.getAllStudent();
|
|
|
this.nowChatList = [];
|
|
|
}
|
|
|
};
|
|
@@ -1032,22 +1100,22 @@ ${_text}
|
|
|
justify-content: space-between;
|
|
|
}
|
|
|
|
|
|
-.tt_i_b_step{
|
|
|
- display: flex;
|
|
|
- width: 100%;
|
|
|
- height: auto;
|
|
|
- margin: 10px 0;
|
|
|
+.tt_i_b_step {
|
|
|
+ display: flex;
|
|
|
+ width: 100%;
|
|
|
+ height: auto;
|
|
|
+ margin: 10px 0;
|
|
|
}
|
|
|
|
|
|
-.tt_i_b_step>span{
|
|
|
- height: 5px;
|
|
|
- background-color: #E0EAFB;
|
|
|
- flex: 1;
|
|
|
- border-left: 2px solid #fff;
|
|
|
+.tt_i_b_step > span {
|
|
|
+ height: 5px;
|
|
|
+ background-color: #e0eafb;
|
|
|
+ flex: 1;
|
|
|
+ border-left: 2px solid #fff;
|
|
|
}
|
|
|
|
|
|
-.tt_i_b_step>span:nth-child(-1){
|
|
|
- border: none;
|
|
|
+.tt_i_b_step > span:nth-child(-1) {
|
|
|
+ border: none;
|
|
|
}
|
|
|
|
|
|
.tt_i_box > img {
|
|
@@ -1074,7 +1142,7 @@ ${_text}
|
|
|
|
|
|
.tt_i_b_box {
|
|
|
width: auto;
|
|
|
- min-width: 140px;
|
|
|
+ min-width: 140px;
|
|
|
height: 60px;
|
|
|
box-sizing: border-box;
|
|
|
border: solid 1px #e0eafb;
|
|
@@ -1084,8 +1152,8 @@ ${_text}
|
|
|
|
|
|
.tt_i_b_b_item {
|
|
|
width: 70px;
|
|
|
- min-width: 70px;
|
|
|
- flex: 1;
|
|
|
+ min-width: 70px;
|
|
|
+ flex: 1;
|
|
|
height: 100%;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
@@ -1394,13 +1462,13 @@ ${_text}
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
|
|
|
-.t_b_btn>div{
|
|
|
- width: 100%;
|
|
|
- height:100%;
|
|
|
- display:flex;
|
|
|
- justify-content:center;
|
|
|
- align-items:center;
|
|
|
- color:#fff;
|
|
|
+.t_b_btn > div {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ color: #fff;
|
|
|
}
|
|
|
|
|
|
.t_b_btn > span {
|
|
@@ -1416,31 +1484,50 @@ th {
|
|
|
padding: 10px;
|
|
|
}
|
|
|
|
|
|
-.s_t_addAsk{
|
|
|
- width:100%;
|
|
|
- height:auto;
|
|
|
- padding:10px 20px;
|
|
|
- display:flex;
|
|
|
- flex-direction:column;
|
|
|
- justify-content:center;
|
|
|
- align-items:center;
|
|
|
- box-sizing:border-box;
|
|
|
+.s_t_addAsk {
|
|
|
+ width: 100%;
|
|
|
+ height: auto;
|
|
|
+ padding: 10px 20px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+
|
|
|
+.s_t_addAsk > span {
|
|
|
+ box-sizing: border-box;
|
|
|
+ width: auto;
|
|
|
+ height: auto;
|
|
|
+ padding: 15px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ background-color: #f5f6f7;
|
|
|
+ border-radius: 10px;
|
|
|
+ cursor: pointer;
|
|
|
+ border: solid 1px #e8e9ec;
|
|
|
+ transition: 0.3s;
|
|
|
+}
|
|
|
+
|
|
|
+.s_t_addAsk > span:hover {
|
|
|
+ background-color: #e8e9ec;
|
|
|
}
|
|
|
|
|
|
-.s_t_addAsk>span{
|
|
|
- box-sizing:border-box;
|
|
|
- width:auto;
|
|
|
- height:auto;
|
|
|
- padding:15px;
|
|
|
- margin-bottom:10px;
|
|
|
- background-color:#F5F6F7;
|
|
|
- border-radius:10px;
|
|
|
- cursor:pointer;
|
|
|
- border:solid 1px #E8E9EC;
|
|
|
- transition:.3s;
|
|
|
+.d_t_c_a_r_c_img:hover .download_image {
|
|
|
+ display: block;
|
|
|
}
|
|
|
|
|
|
-.s_t_addAsk>span:hover{
|
|
|
- background-color:#E8E9EC;
|
|
|
+.download_image {
|
|
|
+ position: absolute;
|
|
|
+ display: none;
|
|
|
+ right: 5px;
|
|
|
+ bottom: 5px;
|
|
|
+ width: 30px;
|
|
|
+ height: 30px;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
+
|
|
|
+.download_image > img {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
}
|
|
|
</style>
|