Skip to content

Commit

Permalink
perf: 增加智能问答
Browse files Browse the repository at this point in the history
  • Loading branch information
huailei000 committed Dec 26, 2023
1 parent f578b6e commit 07d2e14
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 1 deletion.
5 changes: 5 additions & 0 deletions proxy.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,10 @@
"secure": false,
"ws": true,
"changeOrigin": true
},
"/ui/": {
"target": "http://localhost:9528",
"secure": false,
"changeOrigin": true
}
}
11 changes: 11 additions & 0 deletions src/app/elements/chat/chat.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div class="chat-container" [hidden]="isHidden" (click)="toggle()">
<div class="content">
<iframe
#iFrame
[src]="iframeURL | safeUrl"
title="chat"
height="100%"
width="100%"
></iframe>
</div>
</div>
15 changes: 15 additions & 0 deletions src/app/elements/chat/chat.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.chat-container {
height: 100vh;
width: 100vw;
overflow: hidden;
.content {
height: 100%;
width: 440px;
float: right;
background-color: #ffffff;
transition: transform .25s cubic-bezier(.7, .3, .1, 1);
iframe {
border: none;
}
}
}
23 changes: 23 additions & 0 deletions src/app/elements/chat/chat.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {Component, ViewChild, ElementRef} from '@angular/core';


@Component({
selector: 'elements-chat',
templateUrl: './chat.component.html',
styleUrls: ['./chat.component.scss'],
})

export class ElementChatComponent {
@ViewChild('iFrame', {static: false}) iframeRef: ElementRef;

isHidden = true;
iframeURL: String;

constructor() {
this.iframeURL = '/ui/#/chat/chatai';
}

toggle() {
this.isHidden = !this.isHidden;
}
}
3 changes: 2 additions & 1 deletion src/app/elements/elements.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {ElementsReplayMp4Component} from './replay/mp4/mp4.component';
import {ElementConnectorGuideComponent} from '@app/elements/content/content-window/guide/guide.component';
import {ElementCommandDialogComponent} from '@app/elements/content/command-dialog/command-dialog.component';
import {ElementSendCommandDialogComponent} from '@app/elements/content/send-command-dialog/send-command-dialog.component';

import {ElementChatComponent} from '@app/elements/chat/chat.component';

export const ElementComponents = [
ElementLeftBarComponent,
Expand All @@ -43,6 +43,7 @@ export const ElementComponents = [
ElementUserFileComponent,
ElementTermComponent,
ElementNavComponent,
ElementChatComponent,
ElementIframeComponent,
ElementDialogAlertComponent,
ElementAssetTreeComponent,
Expand Down
15 changes: 15 additions & 0 deletions src/app/elements/nav/nav.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,21 @@
line-height: 30px;
}

.nav-right > span img {
width: 18px;
height: 19px;
transform: translateY(30%);
cursor: pointer;
filter: grayscale(1);
}

.nav-right .chat {
position: fixed;
top: 0px;
right: 0px;
z-index: 11;
}

.elements-organization {
flex: 1;
text-align: right;
Expand Down
4 changes: 4 additions & 0 deletions src/app/elements/nav/nav.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
</li>
</ul>
<div class="nav-right">
<span>
<img [matTooltip]="('Question answer' | translate)" alt="" src="assets/icons/robot-assistant.png" (click)="chat.toggle()" />
<elements-chat #chat class="chat"></elements-chat>
</span>
<elements-user-profile></elements-user-profile>
</div>
</div>
1 change: 1 addition & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"Run it by client": "Run it by client",
"Name": "Name",
"Tips": "Tips",
"Question answer": "Question answer",
"Asset not found or You have no permission to access it, please refresh asset tree": "Asset not found or You have no permission to access it, please refresh asset tree",
"With secret accounts": "With secret accounts",
"Close": "Close",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
"General": "基本構成",
"GUI": "グラフィカル",
"CLI": "コマンドライン",
"Question answer": "質問-答え",
"Asset not found or You have no permission to access it, please refresh asset tree": "アセットが見つからないか、アクセスする権限がありません。アセット ツリーを更新してください",
"Run it by client": "クライアントで実行する",
"Name": "めいしょう",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
"Applet": "远程应用",
"GUI": "图形化",
"Tips": "提示",
"Question answer": "智能问答",
"Asset not found or You have no permission to access it, please refresh asset tree": "未找到资产或您无权访问它,请刷新资产树",
"CLI": "命令行",
"Close": "关闭",
Expand Down
Binary file added src/assets/icons/robot-assistant.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 07d2e14

Please sign in to comment.