diff options
-rw-r--r-- | usecaseui-portal/package-lock.json | 5 | ||||
-rw-r--r-- | usecaseui-portal/proxy.conf.json | 10 | ||||
-rw-r--r-- | usecaseui-portal/src/app/app-routing.module.ts | 4 | ||||
-rw-r--r-- | usecaseui-portal/src/app/app.component.html | 13 | ||||
-rw-r--r-- | usecaseui-portal/src/app/app.module.ts | 2 | ||||
-rw-r--r-- | usecaseui-portal/src/app/views/robot/robot.component.html | 21 | ||||
-rw-r--r-- | usecaseui-portal/src/app/views/robot/robot.component.less | 91 | ||||
-rw-r--r-- | usecaseui-portal/src/app/views/robot/robot.component.ts | 35 | ||||
-rw-r--r-- | usecaseui-portal/src/assets/i18n/cn.json | 3 | ||||
-rw-r--r-- | usecaseui-portal/src/assets/i18n/en.json | 3 | ||||
-rw-r--r-- | usecaseui-portal/src/assets/images/answer.png | bin | 0 -> 5808 bytes | |||
-rw-r--r-- | usecaseui-portal/src/assets/images/robot-active.png | bin | 0 -> 2141 bytes | |||
-rw-r--r-- | usecaseui-portal/src/assets/images/robot-hui.png | bin | 0 -> 2152 bytes | |||
-rw-r--r-- | usecaseui-portal/src/assets/images/send.png | bin | 0 -> 1874 bytes | |||
-rw-r--r-- | usecaseui-portal/src/assets/images/user.png | bin | 0 -> 5799 bytes |
15 files changed, 182 insertions, 5 deletions
diff --git a/usecaseui-portal/package-lock.json b/usecaseui-portal/package-lock.json index 15f4d218..c08f4dc4 100644 --- a/usecaseui-portal/package-lock.json +++ b/usecaseui-portal/package-lock.json @@ -519,6 +519,11 @@ "font-awesome": "*" } }, + "font-awesome": { + "version": "4.7.0", + "resolved": "https://registry.npmmirror.com/font-awesome/-/font-awesome-4.7.0.tgz", + "integrity": "sha512-U6kGnykA/6bFmg1M/oT9EkFeIYv7JlX3bozwQJWiiLz6L0w3F5vBVPxHlwyX/vtNq1ckcpRKOB9f2Qal/VtFpg==" + }, "ansi-align": { "version": "3.0.0", "resolved": "https://registry.npm.taobao.org/ansi-align/download/ansi-align-3.0.0.tgz", diff --git a/usecaseui-portal/proxy.conf.json b/usecaseui-portal/proxy.conf.json index 1ca1ad8a..e6a11340 100644 --- a/usecaseui-portal/proxy.conf.json +++ b/usecaseui-portal/proxy.conf.json @@ -5,8 +5,14 @@ "logLevel": "debug", "changeOrigin": true }, - "/api/usecaseui-intent-analysis/v1": { - "target": "https://192.168.235.25:30283", + "/api/usecaseui-intent-analysis/v1": { + "target": "http://localhost:8083", + "secure": false, + "logLevel": "debug", + "changeOrigin": true + }, + "/api/usecaseui-llm-adaptation/v1": { + "target": "http://localhost:8084", "secure": false, "logLevel": "debug", "changeOrigin": true diff --git a/usecaseui-portal/src/app/app-routing.module.ts b/usecaseui-portal/src/app/app-routing.module.ts index 9c9235f4..ed744106 100644 --- a/usecaseui-portal/src/app/app-routing.module.ts +++ b/usecaseui-portal/src/app/app-routing.module.ts @@ -36,6 +36,7 @@ import { MonitorServiceComponent } from './views/services/sotn-management/monito import { OrderServiceComponent } from './views/services/sotn-management/order-service/order-service.component'; import { SotnManagementComponent } from './views/services/sotn-management/sotn-management.component'; import { IntentManagementComponent } from './views/intent-management/intent-management.component'; +import { RobotComponent } from './views/robot/robot.component'; @@ -71,7 +72,8 @@ const routes: Routes = [ { path: 'network/ccvpn-network', component: CcvpnNetworkComponent }, { path: 'network/mdons-network', component: MdonsNetworkComponent }, { path: 'intent-management', component:IntentManagementComponent}, - { path: '**', redirectTo: 'home', pathMatch: 'full' } + { path: 'robot', component: RobotComponent } + //{ path: '**', redirectTo: 'home', pathMatch: 'full' } ]; @NgModule({ diff --git a/usecaseui-portal/src/app/app.component.html b/usecaseui-portal/src/app/app.component.html index cb4c9f7d..c965d18b 100644 --- a/usecaseui-portal/src/app/app.component.html +++ b/usecaseui-portal/src/app/app.component.html @@ -142,6 +142,19 @@ </span> </a> </li> + <!-- robot --> + <li nz-menu-item [ngClass]="{'activeMenuBar': url === 'robot'}"> + <a routerLink="robot"> + <span title> + <i> + <img + src="{{url === 'robot' ? 'assets/images/robot-active.png':'assets/images/robot-hui.png'}}" + alt="home"> + </i> + <span>{{"i18nTextDefine_robot" | translate}} </span> + </span> + </a> + </li> <hr> </ul> </nz-sider> diff --git a/usecaseui-portal/src/app/app.module.ts b/usecaseui-portal/src/app/app.module.ts index 965ffa10..852c6660 100644 --- a/usecaseui-portal/src/app/app.module.ts +++ b/usecaseui-portal/src/app/app.module.ts @@ -116,6 +116,7 @@ import { InputIntentStateComponent } from './views/intent-management/input-inten import { InputIntentConditionComponent } from './views/intent-management/input-intent-condition/input-intent-condition.component'; import { IntentReportDetailComponent } from './views/intent-management/intent-report-detail/intent-report-detail.component'; import { AngularDateTimePickerModule } from 'angular2-datetimepicker'; +import { RobotComponent } from './views/robot/robot.component'; export function HttpLoaderFactory(httpClient: HttpClient) { return new TranslateHttpLoader(httpClient, "./assets/i18n/", ".json"); @@ -221,6 +222,7 @@ registerLocaleData(en); InputIntentStateComponent, InputIntentConditionComponent, IntentReportDetailComponent, + RobotComponent ], imports: [ BrowserModule, diff --git a/usecaseui-portal/src/app/views/robot/robot.component.html b/usecaseui-portal/src/app/views/robot/robot.component.html new file mode 100644 index 00000000..38363a8a --- /dev/null +++ b/usecaseui-portal/src/app/views/robot/robot.component.html @@ -0,0 +1,21 @@ +<body > +<div class="chat-container"> + <div *ngFor="let chat of chatHistory"> + <div class="question"> + <img src="assets/images/user.png"> + <span>{{ chat.question }}</span> + </div> + <br> + <div class="answer"><img src="assets/images/answer.png"> + <span>{{ chat.answer }}</span> + </div> + <br> + </div> +</div> +<div class="input-wrapper"> + <textarea nz-tooltip nz-input [nzAutosize]="{ minRows: 2, maxRows: 2 }" [(ngModel)]="question" class="text-input"></textarea> + <i class="icon" (click)="submitQuestion()"> + <img src="assets/images/send.png"> + </i> +</div> +</body>
\ No newline at end of file diff --git a/usecaseui-portal/src/app/views/robot/robot.component.less b/usecaseui-portal/src/app/views/robot/robot.component.less new file mode 100644 index 00000000..be02efd8 --- /dev/null +++ b/usecaseui-portal/src/app/views/robot/robot.component.less @@ -0,0 +1,91 @@ +body { + background-color: #e6e6fa; + width: 100%; + margin: 0; + padding: 0; + min-height: 100vh; + display: flex; + flex-direction: column; +} +.chat-container { + margin: 20px 0; + padding: 0 100px; +} +.question { + display: flex; +} +.record-input{ + margin-left: 10px; + resize: none; +} +.question span { + background-color: white; + font-size: 16px; + margin-left: 10px; + padding: 10px; + border-radius: 8px; +} +.question img { + width: 28px; + height: 28px; +} + +.answer { + display: flex; +} +.answer span{ + background-color: white; + font-size: 16px; + margin-left: 10px; + padding: 10px; + border-radius: 8px; + white-space: pre-line; +} +.answer img { + width: 28px; + height: 28px; +} + +.chat-input { + margin-top: 30px; + padding-left: 1100px; +} + +.input-wrapper { + display: flex; + justify-content: space-around; + width: e("calc(100% - 240px)"); + margin: 0 100px; + margin-left: 138px; + padding: 10px; + background: #fff; + border-radius: 8px; + border: 2px solid #8a2be2; +} + +.text-input { + width: e("calc(100% - 50px)"); + background-color: white; + color: black; + text-align: left; + border: 0; + resize: none; + + &:focus { + border: 0 !important; + box-shadow: none; + } +} + +.icon { + width: 50px; + height: 50px; + cursor: pointer; + + >img { + width: 35px; + height: 31px; + margin-top: 15px; + margin-left: 15px; + } +} 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'); + }); + } +} diff --git a/usecaseui-portal/src/assets/i18n/cn.json b/usecaseui-portal/src/assets/i18n/cn.json index bce7dc0e..31815c81 100644 --- a/usecaseui-portal/src/assets/i18n/cn.json +++ b/usecaseui-portal/src/assets/i18n/cn.json @@ -187,5 +187,6 @@ "i18nTextDefine_ExternalNetworkMessage":"注意:两个端点都将更改为ENNI。", "i18nTextDefine_exportData": "导出", "i18nTextDefine_startTime": "起始时间", - "i18nTextDefine_endTime": "终止时间" + "i18nTextDefine_endTime": "终止时间", + "i18nTextDefine_robot": "大模型" } diff --git a/usecaseui-portal/src/assets/i18n/en.json b/usecaseui-portal/src/assets/i18n/en.json index cc533c1c..c1219c71 100644 --- a/usecaseui-portal/src/assets/i18n/en.json +++ b/usecaseui-portal/src/assets/i18n/en.json @@ -186,5 +186,6 @@ "i18nTextDefine_Size":"Size", "i18nTextDefine_exportData": "Export Data", "i18nTextDefine_startTime": "Start Time", - "i18nTextDefine_endTime": "End Time" + "i18nTextDefine_endTime": "End Time", + "i18nTextDefine_robot": "Large Model" } diff --git a/usecaseui-portal/src/assets/images/answer.png b/usecaseui-portal/src/assets/images/answer.png Binary files differnew file mode 100644 index 00000000..f8808023 --- /dev/null +++ b/usecaseui-portal/src/assets/images/answer.png diff --git a/usecaseui-portal/src/assets/images/robot-active.png b/usecaseui-portal/src/assets/images/robot-active.png Binary files differnew file mode 100644 index 00000000..44027896 --- /dev/null +++ b/usecaseui-portal/src/assets/images/robot-active.png diff --git a/usecaseui-portal/src/assets/images/robot-hui.png b/usecaseui-portal/src/assets/images/robot-hui.png Binary files differnew file mode 100644 index 00000000..47c61a3e --- /dev/null +++ b/usecaseui-portal/src/assets/images/robot-hui.png diff --git a/usecaseui-portal/src/assets/images/send.png b/usecaseui-portal/src/assets/images/send.png Binary files differnew file mode 100644 index 00000000..5b58994b --- /dev/null +++ b/usecaseui-portal/src/assets/images/send.png diff --git a/usecaseui-portal/src/assets/images/user.png b/usecaseui-portal/src/assets/images/user.png Binary files differnew file mode 100644 index 00000000..a56313ac --- /dev/null +++ b/usecaseui-portal/src/assets/images/user.png |