|
@@ -24,7 +24,6 @@ import { CustomerServiceComponent } from '../customer-service/customer-service.c
|
|
|
})
|
|
|
export class Tab2Page {
|
|
|
|
|
|
- isModalOpen: boolean = false; // 定义 isModalOpen 属性
|
|
|
placeholderText: string = '';
|
|
|
placeholderIndex: number = 0;
|
|
|
placeholders: string[] = ['智能陪聊', '普通聊天', '小贴心建议'];
|
|
@@ -50,14 +49,13 @@ export class Tab2Page {
|
|
|
this.cyclePlaceholder();
|
|
|
}
|
|
|
matchedCounselor: { name: string; specialty: string } | null = null;
|
|
|
+ isModalOpen: boolean = false; // 定义 isModalOpen 属性
|
|
|
async clickToConsult(chatpartner: CloudObject) {
|
|
|
await this.initChat(chatpartner, true);
|
|
|
}
|
|
|
-
|
|
|
async goChat(chatcompanion: CloudObject) {
|
|
|
await this.initChat(chatcompanion, false);
|
|
|
}
|
|
|
-
|
|
|
private async initChat(partner: CloudObject, isConsult: boolean) {
|
|
|
// 验证用户登录
|
|
|
let currentUser = new CloudUser();
|
|
@@ -106,10 +104,10 @@ export class Tab2Page {
|
|
|
chat.role.set("name", partner.get("name"));
|
|
|
chat.role.set("bio", partner.get("bio"));
|
|
|
chat.role.set("expertise", partner.get("expertise"));
|
|
|
- chat.role.set("avatar", partner.get("avatar") || "/assets/img/2.png"); // 设置聊天伙伴头像
|
|
|
+ chat.role.set("avatar", partner.get("avatar") || "/assets/img/2.png");
|
|
|
chat.role.set("prompt", `
|
|
|
# 角色设定
|
|
|
- 您是${partner.get("name")},一位${partner.get("bio")}的聊天伙伴,需要为用户提供陪伴和支持等积极情绪。
|
|
|
+ 您是${partner.get("name")},一位在${partner.get("expertise")}专业领域的${partner.get("bio")}的聊天伙伴,需要为用户提供陪伴和支持等积极情绪。
|
|
|
# 开始话语
|
|
|
当您准备好了,可以以一个关心用户的朋友的身份,向来访的用户打招呼
|
|
|
# 对话环节
|