import { Component, OnInit } from '@angular/core';
// 引用FmodeChatCompletion类
import { TestChatCompletion, TestChatMessage } from './class-chat-completion';

@Component({
  selector: 'app-chat',
  templateUrl: './chat.page.html',
  styleUrls: ['./chat.page.scss'],
})
export class ChatPage implements OnInit {
  messageList:Array<TestChatMessage> = []
  userInput:string = ""

  completion:TestChatCompletion
  constructor() { 
    this.completion = new TestChatCompletion(this.messageList)
  }

  ngOnInit() {
  }
  sendMessage(){
    this.messageList.push({
      role:"user",
      content: this.userInput
    })
    this.userInput = ""
    this.completion.createCompletionByStream()

  }

}
