import { Component } from '@angular/core';
import {
  ModalController,
  IonHeader, IonTitle, IonContent,
  IonButton, IonList, IonItem, IonLabel, IonIcon, IonCardContent, IonCardSubtitle, IonCardTitle,
  IonCardHeader, IonCard, IonRow, IonCol, IonGrid,
  IonAvatar, IonBadge, IonText, IonListHeader, IonToolbar, IonFooter
} from '@ionic/angular/standalone';
import { NavController } from '@ionic/angular/standalone';
import { ChatPanelOptions, FmodeChat, openChatPanelModal } from 'fmode-ng';
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
import { CommonModule } from '@angular/common';

import * as Parse from 'parse';
@Component({
  selector: 'app-tab2',
  templateUrl: 'tab2.page.html',
  styleUrls: ['tab2.page.scss'],
  standalone: true,
  imports:[ExploreContainerComponentModule,
        CommonModule,
    IonHeader, IonTitle, IonContent,
    IonButton, IonList, IonItem, IonLabel, IonIcon, IonAvatar,
    IonCardContent, IonCardSubtitle, IonCardTitle,
    IonCardHeader, IonCard, IonRow, IonCol, IonGrid,
    IonAvatar, IonBadge, IonText, IonListHeader, IonToolbar, IonFooter,
    // ASR语音输入模块
  ],
   providers: [ModalController] // 添加这一行
})
export class Tab2Page {

  constructor(
    private modalCtrl: ModalController,
     private navCtrl:NavController,) {
    
  }
 goAI(){
    this.navCtrl.navigateRoot(['app','demo','aimessage'])
  }

    /**
   * 开始聊天
   */
  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)
  }
}
