diff options
author | kaixiliu <liukaixi@chinamobile.com> | 2024-04-10 15:14:17 +0800 |
---|---|---|
committer | kaixiliu <liukaixi@chinamobile.com> | 2024-04-10 15:14:37 +0800 |
commit | fdefcecfc6d983f5e7e6d3a60a13dcfadc7a7721 (patch) | |
tree | fb636710ee5a67dc396e751fbdc419e41805ac25 /usecaseui-portal/src/app/views/robot/robot.component.ts | |
parent | fe3dc03b0422f7504acd650151fdcec521fdd4a6 (diff) |
Add a large model page
Issue-ID: USECASEUI-834
Change-Id: Ie589e0eb9c263ed1ec92119470ea46f4a936041b
Signed-off-by: kaixiliu <liukaixi@chinamobile.com>
Diffstat (limited to 'usecaseui-portal/src/app/views/robot/robot.component.ts')
-rw-r--r-- | usecaseui-portal/src/app/views/robot/robot.component.ts | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/usecaseui-portal/src/app/views/robot/robot.component.ts b/usecaseui-portal/src/app/views/robot/robot.component.ts new file mode 100644 index 00000000..5304e876 --- /dev/null +++ b/usecaseui-portal/src/app/views/robot/robot.component.ts @@ -0,0 +1,35 @@ +import { Component, OnInit } from '@angular/core'; +import { NzMessageService } from 'ng-zorro-antd'; +import { HttpClient } from '@angular/common/http'; + +@Component({ + selector: 'app-robot', + templateUrl: './robot.component.html', + styleUrls: ['./robot.component.less'] +}) +export class RobotComponent implements OnInit { + + question: string; + communicationMessage: string; + chatHistory: { question: string, answer: string }[] = []; + apiUrl = '/api/usecaseui-llm-adaptation/v1/getHelper'; + + constructor( + private http: HttpClient, + private message: NzMessageService + ) { } + ngOnInit() {} + + submitQuestion() { + this.http.post<any>(this.apiUrl,this.question,{ responseType: 'text' as 'json'}).subscribe((data) => { + if(data==''){ + this.chatHistory.push({ question: this.question, answer: 'network error' }); + }else{ + this.chatHistory.push({ question: this.question, answer: data }); + } + this.question = ''; + }, error => { + this.message.error('error'); + }); + } +} |