|
@@ -0,0 +1,26 @@
|
|
|
+import { Component, OnInit } from '@angular/core';
|
|
|
+
|
|
|
+@Component({
|
|
|
+ selector: 'app-aichat',
|
|
|
+ templateUrl: './aichat.page.html',
|
|
|
+ styleUrls: ['./aichat.page.scss'],
|
|
|
+})
|
|
|
+export class AIChatPage implements OnInit {
|
|
|
+
|
|
|
+ constructor() { }
|
|
|
+ chatMessages: any[] = [
|
|
|
+ { sender: 'AI Bot', senderAvatar: 'assets/img/d.webp', content: '欢迎来到AI对话', timestamp: new Date() }
|
|
|
+ ];
|
|
|
+ newMessage: string = '';
|
|
|
+
|
|
|
+ sendMessage() {
|
|
|
+ if (this.newMessage.trim() !== '') {
|
|
|
+ this.chatMessages.push({ sender: 'User', senderAvatar: 'assets/user-avatar.png', content: this.newMessage, timestamp: new Date() });
|
|
|
+ this.newMessage = ''; // 清空输入框
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ngOnInit() {
|
|
|
+ }
|
|
|
+
|
|
|
+}
|