diff --git a/ide/src/base-ui/menu/LitMainMenu.ts b/ide/src/base-ui/menu/LitMainMenu.ts index e5465cc75cf409c6e2bdbfcb113caeaeaeeab76c..adbcba1e254da480fa3ed289dfcb990736506897 100644 --- a/ide/src/base-ui/menu/LitMainMenu.ts +++ b/ide/src/base-ui/menu/LitMainMenu.ts @@ -299,6 +299,7 @@ export class LitMainMenu extends BaseElement {
+
`; diff --git a/ide/src/trace/SpApplication.ts b/ide/src/trace/SpApplication.ts index ed72661feed96045cd012c210a246ed2591da214..98fbf1cab9c242bd5049fcdf2b0f65349c562e0e 100644 --- a/ide/src/trace/SpApplication.ts +++ b/ide/src/trace/SpApplication.ts @@ -119,6 +119,7 @@ export class SpApplication extends BaseElement { | null; static skinChange: Function | null | undefined = null; static skinChange2: Function | null | undefined = null; + static isTraceLoaded: Boolean = false; skinChangeArray: Array = []; private rootEL: HTMLDivElement | undefined | null; private headerDiv: HTMLDivElement | undefined | null; @@ -605,6 +606,7 @@ export class SpApplication extends BaseElement { } private openTraceFile(ev: unknown, isClickHandle?: boolean): void { + SpApplication.isTraceLoaded = false; this.returnOriginalUrl(); this.removeAttribute('custom-color'); this.chartFilter!.setAttribute('hidden', ''); @@ -1230,6 +1232,7 @@ export class SpApplication extends BaseElement { (window as unknown).traceFileName = fileName; } this.showCurrentTraceMenu(fileSize, showFileName, fileName, isDistributed); + SpApplication.isTraceLoaded =true; if (!isDistributed) { this.importConfigDiv!.style.display = Utils.getInstance().getSchedSliceMap().size > 0 ? 'block' : 'none'; } @@ -1963,8 +1966,11 @@ export class SpApplication extends BaseElement { this.croppingFile(this.progressEL!, this.litSearch!); }); - this.aiAnalysis!.addEventListener('click', (ev) => { - if (this.spAiAnalysisPage!.style.visibility === 'hidden') { + let aiAnalysis = this.shadowRoot + ?.querySelector('lit-main-menu')! + .shadowRoot!.querySelector('.ai_analysis') as HTMLDivElement + aiAnalysis!.addEventListener('click', (ev) => { + if (this.spAiAnalysisPage!.style.visibility === 'hidden' || this.spAiAnalysisPage!.style.display === 'none') { this.spAiAnalysisPage!.style.display = 'block'; this.spAiAnalysisPage!.style.visibility = 'visible'; } else { @@ -2179,8 +2185,9 @@ export class SpApplication extends BaseElement { } if (node === showNode) { showNode.style.visibility = 'visible'; - let recordSetting = document.querySelector("body > sp-application")?.shadowRoot?.querySelector("#sp-record-trace")?.shadowRoot?.querySelector("#app-content > record-setting"); - shadowRootInput.preventBubbling(recordSetting!); + //@ts-ignore + } else if (node.id! === 'sp-ai-analysis' && node.style!.visibility! === 'visible') { + return; } else { (node! as HTMLElement).style.visibility = 'hidden'; } diff --git a/ide/src/trace/SpApplicationPublicFunc.ts b/ide/src/trace/SpApplicationPublicFunc.ts index 071c4934dab68813ae700bc23f90984b624439a3..5d05c6140585cb30c1b57ef9aabcb2fc40e13fcd 100644 --- a/ide/src/trace/SpApplicationPublicFunc.ts +++ b/ide/src/trace/SpApplicationPublicFunc.ts @@ -327,7 +327,7 @@ export const applicationHtml: string = ` } #sp-ai-analysis { - top:0px; + top:75px; right:0px; position:absolute; z-index:9999; @@ -387,7 +387,6 @@ export const applicationHtml: string = `
- @@ -397,7 +396,6 @@ export const applicationHtml: string = `
- @@ -423,6 +421,7 @@ export const applicationHtml: string = `
+
`; diff --git a/ide/src/trace/component/SpAiAnalysisPage.html.ts b/ide/src/trace/component/SpAiAnalysisPage.html.ts index 94c5850d0e9422ac3c4bef8dda2f8234cc7279a8..1db54ff00b19504a72c9158d193f76fa66ca8ff2 100644 --- a/ide/src/trace/component/SpAiAnalysisPage.html.ts +++ b/ide/src/trace/component/SpAiAnalysisPage.html.ts @@ -26,7 +26,6 @@ export const SpAiAnalysisPageHtml = `
有什么可以帮助您吗? -
@@ -58,7 +57,7 @@ export const SpAiAnalysisPageHtml = `
- 未连接 + 未连接,请启动本地扩展程序再试![指导]
@@ -119,7 +118,7 @@ export const SpAiAnalysisPageHtml = ` .usersay { max-width: 70%; - background: #4baf50; + background: rgb(229,246,255); border-radius: 4px; float: right; line-height: 20px; @@ -133,24 +132,16 @@ export const SpAiAnalysisPageHtml = ` margin-right: 10px; position: relative; text-align: justify; - color: #fff; - } - - .userTriangle { - width: 0px; - height: 0px; - border-left: solid 8px #4baf50; - border-top: solid 5px rgba(255, 255, 255, 0); - border-bottom: solid 5px rgba(255, 255, 255, 0); - position: absolute; - right: -8px; - top: 8px; + color: #000; + border: 1px solid #c4ebf5; + border-radius: 9px; + border-top-right-radius: 0px; } .systemSay { max-width: 70%; border-radius: 4px; - background-color: #fe7300; + background-color: rgb(249,250,252); float: left; line-height: 20px; text-overflow: ellipsis; @@ -162,18 +153,9 @@ export const SpAiAnalysisPageHtml = ` margin-top: 10px; position: relative; text-align: justify; - color: #fff; - } - - .aiTriangle { - width: 0px; - height: 0px; - border-right: solid 8px #fe7300; - border-top: solid 5px rgba(255, 255, 255, 0); - border-bottom: solid 5px rgba(255, 255, 255, 0); - position: absolute; - left: -7px; - top: 8px; + color: #000; + border: 0.5px solid #eaeaea; + border-radius: 0 10px 10px 10px; } .chatBox { @@ -310,7 +292,6 @@ export const SpAiAnalysisPageHtml = ` font-size: 12px; height: 30px; line-height: 20px; - cursor: pointer; } .rightTabBar img { @@ -466,15 +447,17 @@ export const SpAiAnalysisPageHtml = ` .loginTip { visibility: hidden; position: absolute; - top: 45%; - left: 38%; + top: 28%; + left: 15%; padding: 5px 15px; - background-color: rgba(0, 0, 0, .8); + background-color: rgb(236, 239, 247); border-radius: 2px; - color: #fff; + color: #000; display: flex; align-items: center; - font-size: 12px; + font-size: 14px; + height: 50px; + line-height: 50px; } .loadingItem { diff --git a/ide/src/trace/component/SpAiAnalysisPage.ts b/ide/src/trace/component/SpAiAnalysisPage.ts index 4cb9e287e2c9b495049f45796f5f2811b26d973d..53215972eef26bf985bcfb901916d9046987ff69 100644 --- a/ide/src/trace/component/SpAiAnalysisPage.ts +++ b/ide/src/trace/component/SpAiAnalysisPage.ts @@ -22,6 +22,7 @@ import { WebSocketManager } from '../../webSocket/WebSocketManager'; import { TypeConstants } from '../../webSocket/Constants'; import { TraceRow } from './trace/base/TraceRow'; import { SpSystemTrace } from './SpSystemTrace'; +import { SpApplication } from '../SpApplication'; @element('sp-ai-analysis') export class SpAiAnalysisPage extends BaseElement { @@ -160,7 +161,7 @@ export class SpAiAnalysisPage extends BaseElement { this.loginTipEl!.style.visibility = 'visible'; setTimeout(() => { this.loginTipEl!.style.visibility = 'hidden'; - }, 1000); + }, 4000); return; } // 同一个trace非第一次诊断,无需再发db文件过去 @@ -193,6 +194,9 @@ export class SpAiAnalysisPage extends BaseElement { // 侧边栏诊断点击事件 *************优化,考虑多个按钮 this.reportBar!.addEventListener('click', () => { + if(!SpApplication.isTraceLoaded){ + return; + } this.reportImg!.src = 'img/report_active.png'; this.chatImg!.src = 'img/talk.png'; this.reportBar!.classList.add('active'); @@ -282,10 +286,6 @@ export class SpAiAnalysisPage extends BaseElement { newQuestion.className = "usersay"; // @ts-ignore newQuestion!.innerHTML = this.inputEl!.value; - // 生成聊天气泡三角 - let triangleDiv = document.createElement('div'); - newQuestion.appendChild(triangleDiv); - triangleDiv.className = 'userTriangle'; // 单条消息模块,最大的div,包含头像、消息、清除浮动元素 let newMessage = document.createElement('div'); newMessage.className = 'usermessage message'; @@ -309,9 +309,6 @@ export class SpAiAnalysisPage extends BaseElement { newQuestion.className = "systemSay"; // @ts-ignore newQuestion!.innerHTML = `
${aiText}
`; - let triangleDiv = document.createElement('div'); - newQuestion.appendChild(triangleDiv); - triangleDiv.className = 'aiTriangle'; let newMessage = document.createElement('div'); newMessage.className = 'aiMessage message'; newMessage.appendChild(headerDiv);