1- import * as vscode from ' vscode' ;
2- import { ThemeManager } from ' ../../themes' ;
3- import { IconDefinitions } from ' ../../utils/iconDefinitions' ;
4- import { StyleManager } from ' ../styles' ;
1+ import * as vscode from " vscode" ;
2+ import { ThemeManager } from " ../../themes" ;
3+ import { IconDefinitions } from " ../../utils/iconDefinitions" ;
4+ import { StyleManager } from " ../styles" ;
55
66export class IrisChatView {
7- private _themeManager : ThemeManager ;
8- private _extensionContext : vscode . ExtensionContext ;
9- private _styleManager : StyleManager ;
10-
11- constructor ( extensionContext : vscode . ExtensionContext , styleManager : StyleManager ) {
12- this . _themeManager = new ThemeManager ( ) ;
13- this . _extensionContext = extensionContext ;
14- this . _styleManager = styleManager ;
7+ private _themeManager : ThemeManager ;
8+ private _extensionContext : vscode . ExtensionContext ;
9+ private _styleManager : StyleManager ;
10+
11+ constructor (
12+ extensionContext : vscode . ExtensionContext ,
13+ styleManager : StyleManager
14+ ) {
15+ this . _themeManager = new ThemeManager ( ) ;
16+ this . _extensionContext = extensionContext ;
17+ this . _styleManager = styleManager ;
18+ }
19+
20+ public generateHtml (
21+ webview ?: vscode . Webview ,
22+ showDiagnostics : boolean = false
23+ ) : string {
24+ const themeCSS = this . _themeManager . getThemeCSS ( ) ;
25+ const currentTheme = this . _themeManager . getCurrentTheme ( ) ;
26+ const styles = this . _styleManager . getStyles ( currentTheme , [
27+ "views/iris-chat.css" ,
28+ ] ) ;
29+
30+ const trashIcon = IconDefinitions . getIcon ( "trash" ) ;
31+ const stethoscopeIcon = IconDefinitions . getIcon ( "stethoscope" ) ;
32+ const questionMarkIcon = IconDefinitions . getIcon ( "question-mark" ) ;
33+ const refreshIcon = IconDefinitions . getIcon ( "refresh" ) ;
34+ const courseIcon = IconDefinitions . getIcon ( "course" ) ;
35+ const exerciseIcon = IconDefinitions . getIcon ( "exercise" ) ;
36+ const lockIcon = IconDefinitions . getIcon ( "shield" ) ;
37+ const workspaceIcon = IconDefinitions . getIcon ( "workspace" ) ;
38+ const checkIcon = `<svg viewBox="0 0 16 16" fill="currentColor"><path d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"/></svg>` ;
39+ const plusIcon = `<svg viewBox="0 0 16 16" fill="currentColor"><path d="M8 2a.75.75 0 01.75.75v4.5h4.5a.75.75 0 010 1.5h-4.5v4.5a.75.75 0 01-1.5 0v-4.5h-4.5a.75.75 0 010-1.5h4.5v-4.5A.75.75 0 018 2z"/></svg>` ;
40+ const switchIcon = `<svg viewBox="0 0 16 16" fill="currentColor"><path d="M8 2a.75.75 0 01.75.75v4.5h4.5a.75.75 0 010 1.5h-4.5v4.5a.75.75 0 01-1.5 0v-4.5h-4.5a.75.75 0 010-1.5h4.5v-4.5A.75.75 0 018 2z"/></svg>` ;
41+
42+ // Get the path to the iris logo image
43+ let irisLogoSrc = "" ;
44+ if ( webview ) {
45+ const irisLogoUri = vscode . Uri . file (
46+ this . _extensionContext . asAbsolutePath ( "media/iris-logo-big-left.png" )
47+ ) ;
48+ irisLogoSrc = webview . asWebviewUri ( irisLogoUri ) . toString ( ) ;
1549 }
1650
17- public generateHtml ( webview ?: vscode . Webview , showDiagnostics : boolean = false ) : string {
18- const themeCSS = this . _themeManager . getThemeCSS ( ) ;
19- const currentTheme = this . _themeManager . getCurrentTheme ( ) ;
20- const styles = this . _styleManager . getStyles ( currentTheme , [
21- 'views/iris-chat.css'
22- ] ) ;
23-
24- const trashIcon = IconDefinitions . getIcon ( 'trash' ) ;
25- const stethoscopeIcon = IconDefinitions . getIcon ( 'stethoscope' ) ;
26- const questionMarkIcon = IconDefinitions . getIcon ( 'question-mark' ) ;
27- const refreshIcon = IconDefinitions . getIcon ( 'refresh' ) ;
28- const courseIcon = IconDefinitions . getIcon ( 'course' ) ;
29- const exerciseIcon = IconDefinitions . getIcon ( 'exercise' ) ;
30- const lockIcon = IconDefinitions . getIcon ( 'shield' ) ;
31- const workspaceIcon = IconDefinitions . getIcon ( 'workspace' ) ;
32- const checkIcon = `<svg viewBox="0 0 16 16" fill="currentColor"><path d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"/></svg>` ;
33- const plusIcon = `<svg viewBox="0 0 16 16" fill="currentColor"><path d="M8 2a.75.75 0 01.75.75v4.5h4.5a.75.75 0 010 1.5h-4.5v4.5a.75.75 0 01-1.5 0v-4.5h-4.5a.75.75 0 010-1.5h4.5v-4.5A.75.75 0 018 2z"/></svg>` ;
34- const switchIcon = `<svg viewBox="0 0 16 16" fill="currentColor"><path d="M8 2a.75.75 0 01.75.75v4.5h4.5a.75.75 0 010 1.5h-4.5v4.5a.75.75 0 01-1.5 0v-4.5h-4.5a.75.75 0 010-1.5h4.5v-4.5A.75.75 0 018 2z"/></svg>` ;
35-
36- // Get the path to the iris logo image
37- let irisLogoSrc = '' ;
38- if ( webview ) {
39- const irisLogoUri = vscode . Uri . file (
40- this . _extensionContext . asAbsolutePath ( 'media/iris-logo-big-left.png' )
41- ) ;
42- irisLogoSrc = webview . asWebviewUri ( irisLogoUri ) . toString ( ) ;
43- }
44-
45- return `<!DOCTYPE html>
51+ return `<!DOCTYPE html>
4652<html lang="en">
4753<head>
4854 <meta charset="UTF-8">
@@ -56,7 +62,11 @@ export class IrisChatView {
5662<body class="theme-${ currentTheme } ">
5763 <div class="chat-container">
5864 <div class="chat-header">
59- ${ irisLogoSrc ? `<img src="${ irisLogoSrc } " alt="Iris Logo" class="chat-header-logo" />` : '' }
65+ ${
66+ irisLogoSrc
67+ ? `<img src="${ irisLogoSrc } " alt="Iris Logo" class="chat-header-logo" />`
68+ : ""
69+ }
6070 <h1 class="chat-title">Chat with Iris</h1>
6171 <button class="burger-menu" onclick="toggleSideMenu()" title="Menu">
6272 <div class="burger-icon">
@@ -165,7 +175,7 @@ export class IrisChatView {
165175 </div>
166176 <div class="iris-disclaimer-banner">
167177 <span class="disclaimer-text">
168- Iris only has access to your submitted code .
178+ Iris has access to your uncommitted changes (<a href="#" onclick="openUncommittedChangesSettings(); return false;" class="settings-link">configurable</a>) .
169179 Iris can make mistakes. Consider verifying important information.
170180 </span>
171181 </div>
@@ -244,7 +254,9 @@ export class IrisChatView {
244254 <div class="menu-item-description">Learn how contexts impact responses</div>
245255 </div>
246256 </div>
247- ${ showDiagnostics ? `
257+ ${
258+ showDiagnostics
259+ ? `
248260 <div class="menu-item" onclick="openDiagnostics()">
249261 ${ stethoscopeIcon }
250262 <div class="menu-item-content">
@@ -259,7 +271,9 @@ export class IrisChatView {
259271 <div class="menu-item-description">View raw Artemis session data</div>
260272 </div>
261273 </div>
262- ` : '' }
274+ `
275+ : ""
276+ }
263277 </div>
264278
265279 <div class="menu-section">
@@ -309,6 +323,13 @@ export class IrisChatView {
309323 document.getElementById('helpPopup').classList.remove('open');
310324 };
311325
326+ window.openUncommittedChangesSettings = function() {
327+ vscode.postMessage({
328+ command: 'openSettings',
329+ setting: 'artemis.iris.sendUncommittedChanges'
330+ });
331+ };
332+
312333 let irisState = {
313334 context: null,
314335 activeSessionId: null,
@@ -1078,5 +1099,5 @@ export class IrisChatView {
10781099 </script>
10791100</body>
10801101</html>` ;
1081- }
1102+ }
10821103}
0 commit comments