|
@@ -5,6 +5,8 @@ import { IonButton, IonCard, IonCardContent, IonCardHeader, IonCardTitle, IonIte
|
|
|
IonList,IonSelect, IonSelectOption } from '@ionic/angular/standalone';
|
|
|
import { CommonModule } from '@angular/common';
|
|
|
import { Router } from '@angular/router';
|
|
|
+import { ChatPanelOptions, FmodeChat, openChatPanelModal } from 'fmode-ng';
|
|
|
+import { ModalController } from '@ionic/angular/standalone';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-tab2',
|
|
@@ -22,33 +24,60 @@ import { Router } from '@angular/router';
|
|
|
})
|
|
|
export class Tab2Page {
|
|
|
|
|
|
- constructor(private router: Router) {
|
|
|
+ private modalCtrl: ModalController;
|
|
|
+ constructor(private router: Router,modalCtrl: ModalController) {
|
|
|
+ this.modalCtrl = modalCtrl;
|
|
|
|
|
|
}
|
|
|
consultants = [
|
|
|
{
|
|
|
- name: '智能心理陪聊师',
|
|
|
+ name: '张衡',
|
|
|
+ desc:"是温柔学长,国家中级心理咨询师",
|
|
|
+ title: '中级心理咨询师',
|
|
|
avatar: '/assets/img/2.png',
|
|
|
- fields: ['专业领域:焦虑']
|
|
|
+ tags: ['专业领域:焦虑']
|
|
|
},
|
|
|
{
|
|
|
- name: '智能心理陪聊师',
|
|
|
+ name: '王雅',
|
|
|
+ desc:"是热心学姐,国家中级心理咨询师",
|
|
|
+ title: '中级心理咨询师',
|
|
|
avatar: '/assets/img/4.png',
|
|
|
- fields: ['专业领域:抑郁']
|
|
|
+ tags: ['专业领域:抑郁']
|
|
|
},
|
|
|
{
|
|
|
- name: '智能心理陪聊师',
|
|
|
+ name: '孙晴',
|
|
|
+ desc:"是活泼学妹,国家初级心理咨询师",
|
|
|
+ title: '初级心理咨询师',
|
|
|
avatar: '/assets/img/5.png',
|
|
|
- fields: ['专业领域:压力']
|
|
|
+ tags: ['专业领域:压力']
|
|
|
}
|
|
|
];
|
|
|
-
|
|
|
- clickToConsult() {
|
|
|
-
|
|
|
-
|
|
|
- this.router.navigateByUrl("/chat/session/role/2DXJkRsjXK")
|
|
|
+ clickToConsult(consultant:any) {
|
|
|
+
|
|
|
+ let options:ChatPanelOptions = {
|
|
|
+ roleId:"2DXJkRsjXK",
|
|
|
+ onChatInit: (chat: FmodeChat) => {
|
|
|
+ console.log("onChatInit");
|
|
|
+ console.log("预设角色", chat.role);
|
|
|
+ chat.role.set("name", consultant.name);
|
|
|
+ chat.role.set("title", consultant.title);
|
|
|
+ chat.role.set("desc",consultant.desc);
|
|
|
+ chat.role.set("tags", consultant.tags);
|
|
|
+ chat.role.set("avatar", consultant.avatar)
|
|
|
+ chat.role.set("prompt", `
|
|
|
+ # 角色设定
|
|
|
+ 您是${consultant.name},一位${consultant.title},${consultant.desc},需要为学生提供陪伴和支持等积极情绪。
|
|
|
+`);
|
|
|
+ },
|
|
|
+ onChatSaved:(chat:FmodeChat)=>{
|
|
|
+
|
|
|
+ console.log("onChatSaved",chat,chat?.chatSession,chat?.chatSession?.id)
|
|
|
+ },
|
|
|
+ }
|
|
|
+ openChatPanelModal(this.modalCtrl,options)
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
|
|
|
matchedCounselor: { name: string; specialty: string } | null = null;
|
|
|
|