|
@@ -6,7 +6,9 @@ import { HttpClient } from '@angular/common/http';
|
|
|
import { TestChatCompletion, TestChatMessage } from './class-test-chat-completion';
|
|
|
import { TestRxjsChatCompletion } from './class-rxjs-chat-completion';
|
|
|
|
|
|
-
|
|
|
+import { ModalController } from '@ionic/angular';
|
|
|
+import { ModalSuccessPage } from '../modal-success/modal-success.page';
|
|
|
+import { AlertController } from '@ionic/angular';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-tab3',
|
|
@@ -24,10 +26,13 @@ export class Tab3Page implements OnInit {
|
|
|
messageList:Array<TestChatMessage> = []
|
|
|
userInput:string = ""
|
|
|
|
|
|
+ aiTransportAdvice: string = '';
|
|
|
|
|
|
constructor(
|
|
|
private route: ActivatedRoute,
|
|
|
- private http: HttpClient
|
|
|
+ private http: HttpClient,
|
|
|
+ public modalCtrl: ModalController,
|
|
|
+ private alertController: AlertController
|
|
|
) {}
|
|
|
|
|
|
ngOnInit() {
|
|
@@ -45,6 +50,25 @@ export class Tab3Page implements OnInit {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ async showAlert() {
|
|
|
+ const alert = await this.alertController.create({
|
|
|
+ header: '确认信息',
|
|
|
+ message: '确认信息成功',
|
|
|
+ mode: 'ios',
|
|
|
+ backdropDismiss: false,
|
|
|
+ buttons: [
|
|
|
+ {
|
|
|
+ text: '关闭',
|
|
|
+ handler: () => {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ cssClass: 'custom-alert'
|
|
|
+ });
|
|
|
+ await alert.present();
|
|
|
+ }
|
|
|
+
|
|
|
modifyInfo() {
|
|
|
console.log('信息将被修改');
|
|
|
|
|
@@ -75,6 +99,7 @@ export class Tab3Page implements OnInit {
|
|
|
console.log(`Content: ${content}`);
|
|
|
console.log(`Cumulative Content: ${cumulativeContent}`);
|
|
|
if (done) {
|
|
|
+ this.aiTransportAdvice = cumulativeContent;
|
|
|
console.log('Stream completed');
|
|
|
}
|
|
|
},
|
|
@@ -84,10 +109,20 @@ export class Tab3Page implements OnInit {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
confirmTransport() {
|
|
|
console.log('运输方式已确认');
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ this.presentSuccessModal();
|
|
|
+
|
|
|
+ }
|
|
|
+ async presentSuccessModal() {
|
|
|
+ const modal = await this.modalCtrl.create({
|
|
|
+ component: ModalSuccessPage,
|
|
|
+ cssClass: 'my-custom-class'
|
|
|
+ });
|
|
|
+ return await modal.present();
|
|
|
}
|
|
|
|
|
|
sendMessage(){
|