|
|
@@ -3,11 +3,14 @@ import { Router } from '@angular/router';
|
|
|
import { CommonModule } from '@angular/common';
|
|
|
import { IonHeader, IonToolbar, IonTitle, IonContent, ModalController, IonButton,
|
|
|
IonCard, IonCardHeader, IonCardTitle, IonCardContent,
|
|
|
- IonList, IonItem, IonLabel, IonAvatar, IonInput, IonIcon
|
|
|
+ IonList, IonItem, IonLabel, IonAvatar, IonInput, IonIcon,
|
|
|
+ IonThumbnail,
|
|
|
} from '@ionic/angular/standalone';
|
|
|
import { ExploreContainerComponent } from '../explore-container/explore-container.component';
|
|
|
import { ChatPanelOptions, FmChatModalInput, FmodeChat, FmodeChatMessage, openChatPanelModal } from 'fmode-ng';
|
|
|
// import { ModalAudioMessageComponent } from 'fmode-ng/lib/aigc/chat/chat-modal-input/modal-audio-message/modal-audio-message.component';
|
|
|
+// 引用设计的对象类和查询类
|
|
|
+import { CloudObject, CloudQuery } from 'src/lib/ncloud';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-tab3',
|
|
|
@@ -21,7 +24,8 @@ import { ChatPanelOptions, FmChatModalInput, FmodeChat, FmodeChatMessage, openCh
|
|
|
FmChatModalInput,
|
|
|
// ModalAudioMessageComponent
|
|
|
CommonModule, IonCard, IonCardHeader, IonCardTitle, IonCardContent,
|
|
|
- IonList, IonItem, IonLabel, IonAvatar, IonInput, IonIcon
|
|
|
+ IonList, IonItem, IonLabel, IonAvatar, IonInput, IonIcon, IonThumbnail,
|
|
|
+
|
|
|
]
|
|
|
})
|
|
|
export class Tab3Page {
|
|
|
@@ -48,23 +52,35 @@ export class Tab3Page {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/** 示例:问诊ChatPanel面板 */
|
|
|
- opendazi(){
|
|
|
+ opendazi(filmpartner:CloudObject){
|
|
|
localStorage.setItem("company","E4KpGvTEto")
|
|
|
+
|
|
|
+ // let chat = new CloudObject("FilmChat")
|
|
|
+ // let now = new Date();
|
|
|
+ // let dateStr = `${now.getFullYear()}-${now.getMonth()+1}-${now.getDate()}`
|
|
|
+
|
|
|
+ // consult.set({
|
|
|
+ // title:`${doctor.get('depart')?.name || ""}门诊记录${dateStr}-${doctor?.get("name")}`,
|
|
|
+ // doctor:doctor.toPointer(),
|
|
|
+ // depart:doctor.get("depart")
|
|
|
+ // })
|
|
|
+
|
|
|
let options:ChatPanelOptions = {
|
|
|
roleId:"2DXJkRsjXK",
|
|
|
onChatInit:(chat:FmodeChat)=>{
|
|
|
console.log("onChatInit");
|
|
|
console.log("预设角色",chat.role);
|
|
|
- chat.role.set("name","小嫣");
|
|
|
- chat.role.set("age","20");
|
|
|
+ chat.role.set("name",filmpartner?.get("name"));
|
|
|
+ chat.role.set("age",filmpartner?.get("age"));
|
|
|
chat.role.set("title","资深剧迷");
|
|
|
- chat.role.set("desc","资深小剧迷 小嫣");
|
|
|
- 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("desc",filmpartner?.get("desc"));
|
|
|
+ // chat.role.set("tags",["全能","活泼开朗"]);
|
|
|
+ chat.role.set("avatar",filmpartner?.get("avatar") || "https://nova-cloud.obs.cn-south-1.myhuaweicloud.com/storage/aigc/imagine/Q4Zif7fTbK-0.png")
|
|
|
chat.role.set("prompt",`
|
|
|
# 角色设定
|
|
|
-你是一名全能且活泼开朗的资深影视剧剧迷,小嫣,年龄22岁,需要完成一次轻松愉快的看剧感悟分享的陪聊服务。
|
|
|
+你是${filmpartner?.get("desc")},${filmpartner?.get("name")},年龄${filmpartner?.get("age")}岁,全能且活泼开朗,需要完成一次轻松愉快的看剧感悟分享的陪聊服务。
|
|
|
|
|
|
# 对话环节
|
|
|
1.开始话题(根据用户最近在看的影视剧,围绕具体情节、角色分析、剧情走向等陪用户聊天)
|
|
|
@@ -88,6 +104,12 @@ export class Tab3Page {
|
|
|
if(typeof content == "string"){
|
|
|
if(content?.indexOf("[完成]")>-1){
|
|
|
console.log("陪聊已完成")
|
|
|
+
|
|
|
+ // chat.set({
|
|
|
+ // dialogue:content // 处方内容
|
|
|
+ // })
|
|
|
+ // chat.save();
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
@@ -99,31 +121,33 @@ export class Tab3Page {
|
|
|
openChatPanelModal(this.modalCtrl,options)
|
|
|
}
|
|
|
|
|
|
- openChat(){
|
|
|
- let options:ChatPanelOptions = {
|
|
|
- roleId:"2DXJkRsjXK",
|
|
|
- onChatSaved:(chat:FmodeChat)=>{
|
|
|
- // chat?.chatSession?.id 本次会话的 chatId
|
|
|
+
|
|
|
+// openChat(){
|
|
|
+// let options:ChatPanelOptions = {
|
|
|
+// roleId:"2DXJkRsjXK",
|
|
|
+// onChatSaved:(chat:FmodeChat)=>{
|
|
|
+// // chat?.chatSession?.id 本次会话的 chatId
|
|
|
|
|
|
-console.log("onChatSaved",chat,chat?.chatSession,chat?.chatSession?.id)
|
|
|
+// console.log("onChatSaved",chat,chat?.chatSession,chat?.chatSession?.id)
|
|
|
|
|
|
- },
|
|
|
+// },
|
|
|
|
|
|
- }
|
|
|
- openChatPanelModal(this.modalCtrl,options)
|
|
|
- }
|
|
|
+// }
|
|
|
+// openChatPanelModal(this.modalCtrl,options)
|
|
|
+// }
|
|
|
|
|
|
- restoreChat(chatId:string){
|
|
|
- let options:ChatPanelOptions = {
|
|
|
- roleId:"2DXJkRsjXK",
|
|
|
- chatId:chatId
|
|
|
- }
|
|
|
- openChatPanelModal(this.modalCtrl,options)
|
|
|
- }
|
|
|
+// restoreChat(chatId:string){
|
|
|
+// let options:ChatPanelOptions = {
|
|
|
+// roleId:"2DXJkRsjXK",
|
|
|
+// chatId:chatId
|
|
|
+// }
|
|
|
+// openChatPanelModal(this.modalCtrl,options)
|
|
|
+// }
|
|
|
+
|
|
|
+// goChat(){
|
|
|
+// this.router.navigateByUrl("/chat/session/role/2DXJkRsjXK")
|
|
|
+// }
|
|
|
|
|
|
- goChat(){
|
|
|
- this.router.navigateByUrl("/chat/session/role/2DXJkRsjXK")
|
|
|
- }
|
|
|
|
|
|
|
|
|
// audioModalHeightPoint:number = 0.35;
|
|
|
@@ -148,4 +172,19 @@ console.log("onChatSaved",chat,chat?.chatSession,chat?.chatSession?.id)
|
|
|
// modal.present();
|
|
|
// }
|
|
|
|
|
|
-}
|
|
|
+
|
|
|
+
|
|
|
+ ngOnInit() {
|
|
|
+ // 生命周期:页面加载后,运行医生列表加载函数
|
|
|
+ this.loadFilmPartnerList()
|
|
|
+ }
|
|
|
+
|
|
|
+ // 创建用于数据列表存储的属性
|
|
|
+ filmpartnerList:Array<CloudObject> = []
|
|
|
+ // 查询并加载列表的函数
|
|
|
+ async loadFilmPartnerList(){
|
|
|
+ let query = new CloudQuery("FilmPartner");
|
|
|
+ this.filmpartnerList = await query.find()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|