|
@@ -1,107 +0,0 @@
|
|
|
-import { Component } from '@angular/core';
|
|
|
-import { Router } from '@angular/router';
|
|
|
-import { IonHeader, IonToolbar, IonTitle, IonContent, ModalController, IonButton } from '@ionic/angular/standalone';
|
|
|
-import { ExploreContainerComponent } from '../explore-container/explore-container.component';
|
|
|
-import { ChatPanelOptions, FmChatModalInput, FmodeChat, FmodeChatMessage, openChatPanelModal } from 'fmode-ng';
|
|
|
-
|
|
|
-@Component({
|
|
|
- selector: 'app-chat-panel',
|
|
|
- templateUrl: './chat-panel.component.html',
|
|
|
- styleUrls: ['./chat-panel.component.scss'],
|
|
|
- standalone: true,
|
|
|
- imports: [
|
|
|
- IonHeader, IonToolbar, IonTitle, IonContent,
|
|
|
- IonButton
|
|
|
-]
|
|
|
-})
|
|
|
-export class ChatPanelComponent {
|
|
|
-
|
|
|
- constructor(
|
|
|
- private modalCtrl:ModalController,
|
|
|
- private router:Router,
|
|
|
- ) {
|
|
|
-
|
|
|
- }
|
|
|
- title:string = "123"
|
|
|
- /** 示例:问诊ChatPanel面板 */
|
|
|
- openInquiry(){
|
|
|
- localStorage.setItem("company","E4KpGvTEto")
|
|
|
- let options:ChatPanelOptions = {
|
|
|
- roleId:"2DXJkRsjXK",
|
|
|
- onChatInit:(chat:FmodeChat)=>{
|
|
|
- console.log("onChatInit");
|
|
|
- console.log("预设角色",chat.role);
|
|
|
- chat.role.set("name","晓晓");
|
|
|
- chat.role.set("title","全科医生");
|
|
|
- chat.role.set("desc","一名亲切和蔼的门诊全科主任医生,晓晓,年龄36岁");
|
|
|
- chat.role.set("tags",["全科","门诊"]);
|
|
|
- chat.role.set("avatar","https://nova-cloud.obs.cn-south-1.myhuaweicloud.com/storage/aigc/imagine/Q4Zif7fTbK-0.png")
|
|
|
- chat.role.set("prompt",`
|
|
|
-# 角色设定
|
|
|
-您是一名亲切和蔼的专业的全科医生,晓晓,年龄36岁,需要完成一次完整的门诊服务。
|
|
|
-
|
|
|
-# 对话环节
|
|
|
-0.导诊(根据用户基本情况,引导挂号合适的科室)
|
|
|
-1.预设的问询方式(感冒问呼吸、肚子疼叩诊)
|
|
|
-- 打招呼,以用户自述为主
|
|
|
-- 当信息充足时候,确认用户症状对应的科室,并进入下一个环节
|
|
|
-2.拓展的问询细节
|
|
|
-例如:用户反映呼吸不畅,拓展出:是否咳嗽;是否感觉痛或者痒等其他需要的问题。
|
|
|
-- 当问询细节补充完成后进入下一个环节
|
|
|
-3.初步的诊断结果,并且同时列出检查检验项目
|
|
|
-初步诊断:确定需要有哪些进一步检查
|
|
|
-检查检验:获取医学客观数据
|
|
|
-- 等待用户提交客观数据,进入下一阶段
|
|
|
-4.给出诊断方案并给出处方
|
|
|
-- 完成处方时,请在消息结尾附带: [完成]
|
|
|
-
|
|
|
-# 开始话语
|
|
|
-当您准备好了,可以以一个医生的身份,向来访的用户打招呼。`);
|
|
|
- },
|
|
|
- onMessage:(chat:FmodeChat,message:FmodeChatMessage)=>{
|
|
|
- console.log("onMessage",message)
|
|
|
- let content:any = message?.content
|
|
|
- if(typeof content == "string"){
|
|
|
- if(content?.indexOf("[完成]")>-1){
|
|
|
- console.log("门诊已完成")
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- onChatSaved:(chat:FmodeChat)=>{
|
|
|
- // chat?.chatSession?.id 本次会话的 chatId
|
|
|
- console.log("onChatSaved",chat,chat?.chatSession,chat?.chatSession?.id)
|
|
|
- }
|
|
|
- }
|
|
|
- openChatPanelModal(this.modalCtrl,options)
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 开始聊天
|
|
|
- */
|
|
|
- openChat(){
|
|
|
- let options:ChatPanelOptions = {
|
|
|
- roleId:"2DXJkRsjXK",
|
|
|
- onChatSaved:(chat:FmodeChat)=>{
|
|
|
- // chat?.chatSession?.id 本次会话的 chatId
|
|
|
- console.log("onChatSaved",chat,chat?.chatSession,chat?.chatSession?.id)
|
|
|
- },
|
|
|
- }
|
|
|
- openChatPanelModal(this.modalCtrl,options)
|
|
|
- }
|
|
|
- /**
|
|
|
- * 恢复聊天
|
|
|
- * @chatId 从onChatSaved生命周期中,获取chat?.chatSession?.id
|
|
|
- */
|
|
|
- restoreChat(chatId:string){
|
|
|
- let options:ChatPanelOptions = {
|
|
|
- roleId:"2DXJkRsjXK",
|
|
|
- chatId:chatId
|
|
|
- }
|
|
|
- openChatPanelModal(this.modalCtrl,options)
|
|
|
- }
|
|
|
-
|
|
|
- goChat(){
|
|
|
- this.router.navigateByUrl("/chat/session/role/2DXJkRsjXK")
|
|
|
- }
|
|
|
-
|
|
|
-}
|