diff --git a/src/App.vue b/src/App.vue
index 3d06296649ff3782086b0871db4ba7c56b6472c3..f10ae079b06c5db199e1bf13c1e9badf88d1335d 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -47,17 +47,17 @@ import { fetchEventSource } from '@microsoft/fetch-event-source';
import { apiKey, apiUrl } from './api';
let prompt = '';
-let start_prompt = "请扮演克苏鲁主题,COC模组的keeper,引导我做各种行动."+
+let start_prompt = "请扮演克苏鲁主题COC模组的keeper,引导我做各种行动."+
"背景:1992年, 一位未解之谜探索协会(SEU)的调查员,来到密歇根市,调查托马斯·金博尔家的书籍失窃案."+
"托马斯·金博尔居住在艾尔斯伯里大街 218 号的一栋小屋,热爱读书, 但最近他家里似乎遭了贼,被盗的是一些他叔叔最喜欢的书."+
- "这个谜团有些不同寻常,这位叔叔在一年前就神秘失踪,没有留下任何踪迹."+
+ "这位叔叔在一年前就神秘失踪。"+
"因此,托马斯·金博尔请求调查员调查这起偷书案,同时查明他的叔叔道格拉斯失踪的原因,并承诺提供报酬."+
"以下是我作为调查员的个人信息:";
let checking_prompt = "请你扮演coc模组的keeper,现在回复我信息,再回复我调查阶段可以做的事."+
"调查阶段可做的事:";
// 1.询问附近居民;2.查看墓地周边;3.在图书馆调查本地消息;4.询问警方;5.查阅本地报纸《阿诺兹堡广告报》的旧刊6.查看金博尔家周边.7.结束调查.";
// "以下是我作为调查员的个人信息:";
-let action_prompt = "请你扮演coc模组的keeper,现在回复我行动阶段可以做的事(理论上调查员只能做一件事)."+
+let action_prompt = "请你扮演coc模组的keeper,调查阶段我知道了_____, 现在回复我行动阶段可以做的事(理论上调查员只能做一件事)."+
"行动阶段可做的事:";
// 1.检查道格拉斯·金博尔最喜欢的墓碑;2调查墓地中的隧道;3.监视屋子或墓地.";
// "以下是我作为调查员的个人信息:";
@@ -158,6 +158,7 @@ let results_info_2 = ["调查员成功杀死人影或让它失去行动能力"+
let final = ["针对模组中的这个困局,玩家可能会提出全新的或是不同的解决方案。用水泥封闭坟墓并不会对食尸鬼群体有什么影响,它们本就要废弃这处墓地。"+
"你告诉调查员,可以自行决定是将关于道格拉斯的真相告诉托马斯·金博尔,还是将其隐瞒下来,秘而不宣。报酬是10美元。(大约相当于如今的240美金)故事结束,如果想要重新开始,可以选择下方的按钮发起新对话。"]
+console.log("test")
export default {
data() {
return {
@@ -174,39 +175,41 @@ export default {
checking_list:{1:"1.询问附近居民;",2:"2.查看墓地周边;",3:"3.在图书馆调查本地消息;",
4:"4.询问警方;",5:"5.查阅本地报纸《阿诺兹堡广告报》的旧刊",6:"6.查看金博尔家周边;",7:"7.结束调查."},
action_list:{1:"1.检查道格拉斯·金博尔最喜欢的墓碑;",2:"2调查墓地中的隧道;",3:"3.监视屋子或墓地."},
- status_list:status_prompt,
+ status_prompt:status_prompt,
checking_info:checking_info,
action_info:{1:action_info_1, 2:action_info_2},
result_info:{1:results_info_1, 2:results_info_2},
personal_info:"",
last_sender:"",
final:final,
+ context:"",
}
},
methods: {
handleKeeper(){
- console.log(this.status_id);
+
switch (this.status_id) {
case 0: // start
- return this.getStart();
-
+ this.getStart();
+ break;
case 1: // checking
- return this.getCheckingPrompt();
-
+ this.getCheckingPrompt();
+ break;
case 2: // action
- return this.getActionPrompt();
-
+ this.getActionPrompt();
+ break;
case 3: // result
- return this.getResultPrompt();
-
+ this.getResultPrompt();
+ break;
default:
- return this.getEnd();
+ this.getEnd();
+ break;
}
},
getStart(){
this.status_id = 1;
- return this.status_prompt[0]+this.personal_info;
+ this.context = this.status_prompt[0]+this.personal_info;
},
getCheckingPrompt(){
let sender = this.last_sender;
@@ -249,58 +252,68 @@ export default {
delete this.checking_list[ele_idx];
}
}
- return context+this.status_prompt[1]+str(this.checking_list)+"
调查员信息:"+this.personal_info;
+ if(JSON.stringify(obj) === '{}'){
+ this.status_id=2;
+ }
+ let val = this.personal_info;
+ this.$Message.info({
+ content: context,
+ duration: 3,
+ background: true
+ });
+
+ this.context=context+this.status_prompt[1]+str(this.checking_list)+"
调查员信息:"+this.personal_info;
},
getActionPrompt(){
let sender = this.last_sender;
let context = "";
- if(self.action_id==0){
+ if(this.action_id==0){
context = str(this.action_list);
- self.action_id = self.action_id+1;
- return context+this.status_prompt[2]+"
调查员信息:"+this.personal_info;
+ this.action_id = this.action_id+1;
+ this.context =context+this.status_prompt[2]+"
调查员信息:"+this.personal_info;
}
- if(self.action_id==1){
+ if(this.action_id==1){
if(sender.search("监视")!=-1){
- self.result_id=2;
- context=self.action_info[2];
+ this.result_id=2;
+ context=this.action_info[2];
this.pre_action=2;
}
else{
- self.result_id=1;
- context=self.action_info[1];
+ this.result_id=1;
+ context=this.action_info[1];
this.pre_action=1;
}
- self.action_id = self.action_id+1;
- return context[0]+this.status_prompt[2]+"
调查员信息:"+this.personal_info;
+ this.action_id = this.action_id+1;
+ this.context =context[0]+this.status_prompt[2]+"
调查员信息:"+this.personal_info;
}
- if(self.action_id==2){
+ if(this.action_id==2){
if(sender.search("交谈")!=-1 || sender.search("对话")!=-1 || sender.search("对话")!=-1 || sender.search("相见")!=-1){
- self.result_id=1;
+ this.result_id=1;
}
if(sender.search("战斗")!=-1 || sender.search("攻击")!=-1 || sender.search("格斗")!=-1 || sender.search("闪避")!=-1){
- self.result_id=2;
+ this.result_id=2;
}
if(this.pre_action==1){
- context=self.action_info[1];
+ context=this.action_info[1];
}else{
- context=self.action_info[2];
+ context=this.action_info[2];
}
- self.action_id = self.action_id+1;
- self.status_id=3;
- return context[1]+this.status_prompt[2]+"
调查员信息:"+this.personal_info;
+ this.action_id = this.action_id+1;
+ this.status_id=3;
+ this.context =context[1]+this.status_prompt[2]+"
调查员信息:"+this.personal_info;
}
},
getResultPrompt(){
let context = "";
- if(self.result_id==2){
- context=str(self.result_info[2]);
+ if(this.result_id==2){
+ context=str(this.result_info[2]);
}else{
- context=str(self.result_info[1]);
+ context=str(this.result_info[1]);
}
- return context+this.status_prompt[3]+"
调查员信息:"+this.personal_info;
+ this.context =context+this.status_prompt[3]+"
调查员信息:"+this.personal_info;
},
getEnd(){
- return this.final+"
调查员信息:"+this.personal_info;
+ this.context =this.final+"
调查员信息:"+this.personal_info;
},
handleInit() {
this.$Message.error({
@@ -310,12 +323,22 @@ export default {
});
},
handleSend() {
+ if (this.personal_info === ""){
+
+ this.$Message.error({
+ content:"欢迎来到说书人,请先设置个人信息~",
+ duration: 3,
+ background: true
+ });
+ return 0;
+ }
+
if (this.loading || this.question === '') return;
this.loading = true;
const question = this.question;
- this.question = '';
this.last_sender = this.question;
+ this.question = '';
this.dialogs.push({
id: this.dialogs.length + 1,
@@ -331,6 +354,8 @@ export default {
text: '书页翻动的声音...'
});
+ this.question = '';
+
const dialog = this.dialogs.find(item => item.id === aiDialogID);
/**
@@ -339,7 +364,17 @@ export default {
* 发布到社区后,将消耗运行者的额度
* 注意:如果部署应用,任何人通过部署后的域名访问应用时,都将消耗部署者的额度
*/
- prompt = this.handleKeeper();
+
+ // this.$Message.error({
+ // content: this.context,
+ // duration: 3,
+ // background: true
+ // });
+
+ this.handleKeeper()
+
+ let prompt = this.context;
+ console.log("error", prompt);
const body = {
messages: [
{
@@ -388,7 +423,8 @@ export default {
this.dialogs = [""];
this.showPersonalButton=true;
-
+
+ this.context = "";
this.personal_info = "";
this.status_id = 0;
this.action_id = 0;