|
@@ -367,12 +367,16 @@ export default {
|
|
firstEnterTime:null,
|
|
firstEnterTime:null,
|
|
canGetTips:true,
|
|
canGetTips:true,
|
|
getTipsTimer:null,
|
|
getTipsTimer:null,
|
|
|
|
+ getWangLoading:false,
|
|
|
|
+ canUseWangData:false,
|
|
|
|
+ wangData:"",
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
this.setWidth();
|
|
this.setWidth();
|
|
this.getFileId();
|
|
this.getFileId();
|
|
this.firstEnterTime = new Date().getTime();
|
|
this.firstEnterTime = new Date().getTime();
|
|
|
|
+ this.getWantSearch();
|
|
setTimeout(()=>{
|
|
setTimeout(()=>{
|
|
this.canGetTips = true;
|
|
this.canGetTips = true;
|
|
this.getTipsList()
|
|
this.getTipsList()
|
|
@@ -676,7 +680,114 @@ let params = {
|
|
},
|
|
},
|
|
endCommentAndAnnotate() {
|
|
endCommentAndAnnotate() {
|
|
this.insertMemorandum(`结束使用<span class="btn">批注</span>功能`);
|
|
this.insertMemorandum(`结束使用<span class="btn">批注</span>功能`);
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ getWantSearch() {
|
|
|
|
+ console.log("获取猜你想搜")
|
|
|
|
+ let _uuid = uuidv4();
|
|
|
|
+ this.getWangLoading = true
|
|
|
|
+ this.canUseWangData = false
|
|
|
|
+ this.wangData=""
|
|
|
|
+ let _msg = `
|
|
|
|
+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.
|
|
|
|
+ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenced "Format example".
|
|
|
|
+Instruction: Based on the context, follow "Format example", write content
|
|
|
|
+
|
|
|
|
+## 任务
|
|
|
|
+你的任务是根据“课程信息”,提供用户需要的搜索建议,将搜索建议的结果以有序列表的形式返回给用户。
|
|
|
|
+## 课程信息
|
|
|
|
+#### 课程标题:${this.courseDetail.title ? this.courseDetail.title : ""}
|
|
|
|
+#### 分类:${this.courseDetail.name ? this.courseDetail.name : "无"}
|
|
|
|
+#### 学生年级:${
|
|
|
|
+ this.courseDetail.classname ? this.courseDetail.classname : "无"
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+## 规则
|
|
|
|
+输出结果基于“课程信息”,避免提供无关的信息。
|
|
|
|
+搜索建议的结果符合伦理规范。
|
|
|
|
+## 输出
|
|
|
|
+输出应包括6个相关的搜索建议,每个搜索建议需要以问号的方式结束。
|
|
|
|
+请一步步思考如何根据现有信息推送搜索建议,但是不需要输出搜索建议以外的内
|
|
|
|
+
|
|
|
|
+## 输出格式
|
|
|
|
+搜索建议应以有序列表形式呈现,每个建议包括关键词和简短描述。输出JSON格式的
|
|
|
|
+
|
|
|
|
+## Format example
|
|
|
|
+[{"index": 1,"title": "垃圾分类标准","label": "不同国家的垃圾分类标准和方法?"},{"index": 2,"title":"可回收垃圾处理","label": "可回收垃圾的处理流程和再利用方法?"},{ "index": 3, "title": "有害垃圾的影响", "label": "有害垃圾对环境和人体健康的潜在影响?"},{ "index": 4, "title": "垃圾分类标准", "label": "不同国家的垃圾分类标准和方法?"},{ "index": 5, "title": "可回收垃圾处理", "label": "可回收垃圾的处理流程和再利用方法?"},{ "index": 6, "title": "有害垃圾的影响", "label": "有害垃圾对环境和人体健康的潜在影响?"}]
|
|
|
|
+`;
|
|
|
|
+
|
|
|
|
+ // let params = {
|
|
|
|
+ // model: "gpt-3.5-turbo",
|
|
|
|
+ // temperature: 0,
|
|
|
|
+ // max_tokens: 4096,
|
|
|
|
+ // top_p: 1,
|
|
|
|
+ // frequency_penalty: 0,
|
|
|
|
+ // presence_penalty: 0,
|
|
|
|
+ // messages: [{ role: "user", content: _msg }],
|
|
|
|
+ // uid: _uuid,
|
|
|
|
+ // mind_map_question: ""
|
|
|
|
+ // };
|
|
|
|
+ let params = {
|
|
|
|
+ assistant_id: "6063369f-289a-11ef-8bf4-12e77c4cb76b",
|
|
|
|
+ userId: this.userid,
|
|
|
|
+ message: [{ type: "text", text: _msg }],
|
|
|
|
+ session_name: _uuid,
|
|
|
|
+ // uid: _uuid,
|
|
|
|
+ file_ids: this.fileId,
|
|
|
|
+ model: "gpt-4o-2024-08-06"
|
|
|
|
+ };
|
|
|
|
+ // let params = {
|
|
|
|
+ // message: {
|
|
|
|
+ // anthropic_version: "bedrock-2023-05-31",
|
|
|
|
+ // max_tokens: 4096,
|
|
|
|
+ // temperature: 0,
|
|
|
|
+ // top_p: 1,
|
|
|
|
+ // messages: [{ role: "user", content: _msg }]
|
|
|
|
+ // },
|
|
|
|
+ // uid: _uuid,
|
|
|
|
+ // model: "Claude 3 Sonnet" // Claude 3 Sonnet或者Claude 3 Haiku
|
|
|
|
+ // };
|
|
|
|
+ this.text = "";
|
|
|
|
+
|
|
|
|
+ this.ajax
|
|
|
|
+ // .post("https://gpt4.cocorobo.cn/chat", params)
|
|
|
|
+ // .post("https://claude3.cocorobo.cn/chat", params)
|
|
|
|
+ .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", params)
|
|
|
|
+ .then(res => {
|
|
|
|
+ // console.log(res);
|
|
|
|
+ let _data = res.data.FunctionResponse.message;
|
|
|
|
+ _data = _data.replaceAll("```json", "").replaceAll("```", "");
|
|
|
|
+ const match = _data.match(/\[\s*{[^]*}\s*\]/);
|
|
|
|
+ this.wangData = match[0];
|
|
|
|
+ this.canUseWangData = true;
|
|
|
|
+ this.getWangLoading = false;
|
|
|
|
+ // console.log(_data);
|
|
|
|
+ // console.log(match);
|
|
|
|
+ // this.chatList.find(i => i.uid == _uuid).aiContent = JSON.parse(
|
|
|
|
+ // match[0]
|
|
|
|
+ // );
|
|
|
|
+ // 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;
|
|
|
|
+ })
|
|
|
|
+ .catch(e => {
|
|
|
|
+ this.chatLoading = false;
|
|
|
|
+ this.canUseWangData = false;
|
|
|
|
+ this.getWangLoading = false;
|
|
|
|
+ console.log(e);
|
|
|
|
+ });
|
|
|
|
+ // this.getWAntSearchContent(_uuid);
|
|
|
|
+ },
|
|
|
|
+ getWanData(){
|
|
|
|
+ if(this.wangData && this.canUseWangData){
|
|
|
|
+ const _result = this.wangData;
|
|
|
|
+ this.wangData = "";
|
|
|
|
+ this.canUseWangData = false;
|
|
|
|
+ this.getWantSearch();
|
|
|
|
+ return _result;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|