Add a large model page 57/137557/1
authorkaixiliu <liukaixi@chinamobile.com>
Wed, 10 Apr 2024 07:14:17 +0000 (15:14 +0800)
committerkaixiliu <liukaixi@chinamobile.com>
Wed, 10 Apr 2024 07:14:37 +0000 (15:14 +0800)
Issue-ID: USECASEUI-834
Change-Id: Ie589e0eb9c263ed1ec92119470ea46f4a936041b
Signed-off-by: kaixiliu <liukaixi@chinamobile.com>
15 files changed:
usecaseui-portal/package-lock.json
usecaseui-portal/proxy.conf.json
usecaseui-portal/src/app/app-routing.module.ts
usecaseui-portal/src/app/app.component.html
usecaseui-portal/src/app/app.module.ts
usecaseui-portal/src/app/views/robot/robot.component.html [new file with mode: 0644]
usecaseui-portal/src/app/views/robot/robot.component.less [new file with mode: 0644]
usecaseui-portal/src/app/views/robot/robot.component.ts [new file with mode: 0644]
usecaseui-portal/src/assets/i18n/cn.json
usecaseui-portal/src/assets/i18n/en.json
usecaseui-portal/src/assets/images/answer.png [new file with mode: 0644]
usecaseui-portal/src/assets/images/robot-active.png [new file with mode: 0644]
usecaseui-portal/src/assets/images/robot-hui.png [new file with mode: 0644]
usecaseui-portal/src/assets/images/send.png [new file with mode: 0644]
usecaseui-portal/src/assets/images/user.png [new file with mode: 0644]

index 15f4d21..c08f4dc 100644 (file)
         "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",
index 1ca1ad8..e6a1134 100644 (file)
@@ -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
index 9c9235f..ed74410 100644 (file)
@@ -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({
index cb4c9f7..c965d18 100644 (file)
             <span>{{"i18nTextDefine_IntentManagement" | translate}} </span>
           </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>
index 965ffa1..852c666 100644 (file)
@@ -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 (file)
index 0000000..38363a8
--- /dev/null
@@ -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 (file)
index 0000000..be02efd
--- /dev/null
@@ -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 (file)
index 0000000..5304e87
--- /dev/null
@@ -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');
+      });
+  }
+}
index bce7dc0..31815c8 100644 (file)
   "i18nTextDefine_ExternalNetworkMessage":"注意:两个端点都将更改为ENNI。",
   "i18nTextDefine_exportData": "导出",
   "i18nTextDefine_startTime": "起始时间",
-  "i18nTextDefine_endTime": "终止时间"
+  "i18nTextDefine_endTime": "终止时间",
+  "i18nTextDefine_robot": "大模型"
 }
index cc533c1..c1219c7 100644 (file)
   "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
new file mode 100644 (file)
index 0000000..f880802
Binary files /dev/null and b/usecaseui-portal/src/assets/images/answer.png differ
diff --git a/usecaseui-portal/src/assets/images/robot-active.png b/usecaseui-portal/src/assets/images/robot-active.png
new file mode 100644 (file)
index 0000000..4402789
Binary files /dev/null and b/usecaseui-portal/src/assets/images/robot-active.png differ
diff --git a/usecaseui-portal/src/assets/images/robot-hui.png b/usecaseui-portal/src/assets/images/robot-hui.png
new file mode 100644 (file)
index 0000000..47c61a3
Binary files /dev/null and b/usecaseui-portal/src/assets/images/robot-hui.png differ
diff --git a/usecaseui-portal/src/assets/images/send.png b/usecaseui-portal/src/assets/images/send.png
new file mode 100644 (file)
index 0000000..5b58994
Binary files /dev/null and b/usecaseui-portal/src/assets/images/send.png differ
diff --git a/usecaseui-portal/src/assets/images/user.png b/usecaseui-portal/src/assets/images/user.png
new file mode 100644 (file)
index 0000000..a56313a
Binary files /dev/null and b/usecaseui-portal/src/assets/images/user.png differ