@@ -396,6 +396,7 @@ export class ChatView extends HTMLElement {
396396 }
397397
398398 textArea . value = text ;
399+ this . #props. onTextInputChange ( text ) ;
399400 }
400401
401402 #handleMessageContainerRef( el : Element | undefined ) : void {
@@ -1301,53 +1302,53 @@ function renderChatInput({
13011302 </ div >
13021303 </ form >
13031304` ;
1304- // clang-format on
1305- }
1305+ // clang-format on
1306+ }
13061307
1307- function renderAidaUnavailableContents (
1308- aidaAvailability :
1309- Exclude < Host . AidaClient . AidaAccessPreconditions , Host . AidaClient . AidaAccessPreconditions . AVAILABLE > ) :
1310- Lit . TemplateResult {
1311- switch ( aidaAvailability ) {
1312- case Host . AidaClient . AidaAccessPreconditions . NO_ACCOUNT_EMAIL :
1313- case Host . AidaClient . AidaAccessPreconditions . SYNC_IS_PAUSED : {
1314- return html `${ i18nString ( UIStrings . notLoggedIn ) } ` ;
1315- }
1316- case Host . AidaClient . AidaAccessPreconditions . NO_INTERNET : {
1317- return html `${ i18nString ( UIStrings . offline ) } ` ;
1318- }
1308+ function renderAidaUnavailableContents (
1309+ aidaAvailability :
1310+ Exclude < Host . AidaClient . AidaAccessPreconditions , Host . AidaClient . AidaAccessPreconditions . AVAILABLE > ) :
1311+ Lit . TemplateResult {
1312+ switch ( aidaAvailability ) {
1313+ case Host . AidaClient . AidaAccessPreconditions . NO_ACCOUNT_EMAIL :
1314+ case Host . AidaClient . AidaAccessPreconditions . SYNC_IS_PAUSED : {
1315+ return html `${ i18nString ( UIStrings . notLoggedIn ) } ` ;
1316+ }
1317+ case Host . AidaClient . AidaAccessPreconditions . NO_INTERNET : {
1318+ return html `${ i18nString ( UIStrings . offline ) } ` ;
13191319 }
13201320 }
1321+ }
13211322
1322- function renderConsentViewContents ( ) : Lit . TemplateResult {
1323- const settingsLink = document . createElement ( 'button' ) ;
1324- settingsLink . textContent = i18nString ( UIStrings . settingsLink ) ;
1325- settingsLink . classList . add ( 'link' ) ;
1326- UI . ARIAUtils . markAsLink ( settingsLink ) ;
1327- settingsLink . addEventListener ( 'click' , ( ) => {
1328- void UI . ViewManager . ViewManager . instance ( ) . showView ( 'chrome-ai' ) ;
1329- } ) ;
1330- settingsLink . setAttribute ( 'jslog' , `${ VisualLogging . action ( 'open-ai-settings' ) . track ( { click : true } ) } ` ) ;
1331-
1332- let consentViewContents : HTMLSpanElement ;
1333- // TODO(ergunsh): Should this `view` access `hostConfig` at all?
1334- const config = Root . Runtime . hostConfig ;
1335- if ( config . devToolsAiAssistancePerformanceAgent ?. enabled ) {
1336- consentViewContents = i18n . i18n . getFormatLocalizedString (
1337- str_ , UIStrings . turnOnForStylesRequestsPerformanceAndFiles , { PH1 : settingsLink } ) ;
1338- } else if ( config . devToolsAiAssistanceFileAgent ?. enabled ) {
1339- consentViewContents =
1340- i18n . i18n . getFormatLocalizedString ( str_ , UIStrings . turnOnForStylesRequestsAndFiles , { PH1 : settingsLink } ) ;
1341- } else if ( config . devToolsAiAssistanceNetworkAgent ?. enabled ) {
1342- consentViewContents =
1343- i18n . i18n . getFormatLocalizedString ( str_ , UIStrings . turnOnForStylesAndRequests , { PH1 : settingsLink } ) ;
1344- } else {
1345- consentViewContents = i18n . i18n . getFormatLocalizedString ( str_ , UIStrings . turnOnForStyles , { PH1 : settingsLink } ) ;
1346- }
1323+ function renderConsentViewContents ( ) : Lit . TemplateResult {
1324+ const settingsLink = document . createElement ( 'button' ) ;
1325+ settingsLink . textContent = i18nString ( UIStrings . settingsLink ) ;
1326+ settingsLink . classList . add ( 'link' ) ;
1327+ UI . ARIAUtils . markAsLink ( settingsLink ) ;
1328+ settingsLink . addEventListener ( 'click' , ( ) => {
1329+ void UI . ViewManager . ViewManager . instance ( ) . showView ( 'chrome-ai' ) ;
1330+ } ) ;
1331+ settingsLink . setAttribute ( 'jslog' , `${ VisualLogging . action ( 'open-ai-settings' ) . track ( { click : true } ) } ` ) ;
13471332
1348- return html `${ consentViewContents } ` ;
1333+ let consentViewContents : HTMLSpanElement ;
1334+ // TODO(ergunsh): Should this `view` access `hostConfig` at all?
1335+ const config = Root . Runtime . hostConfig ;
1336+ if ( config . devToolsAiAssistancePerformanceAgent ?. enabled ) {
1337+ consentViewContents = i18n . i18n . getFormatLocalizedString (
1338+ str_ , UIStrings . turnOnForStylesRequestsPerformanceAndFiles , { PH1 : settingsLink } ) ;
1339+ } else if ( config . devToolsAiAssistanceFileAgent ?. enabled ) {
1340+ consentViewContents =
1341+ i18n . i18n . getFormatLocalizedString ( str_ , UIStrings . turnOnForStylesRequestsAndFiles , { PH1 : settingsLink } ) ;
1342+ } else if ( config . devToolsAiAssistanceNetworkAgent ?. enabled ) {
1343+ consentViewContents =
1344+ i18n . i18n . getFormatLocalizedString ( str_ , UIStrings . turnOnForStylesAndRequests , { PH1 : settingsLink } ) ;
1345+ } else {
1346+ consentViewContents = i18n . i18n . getFormatLocalizedString ( str_ , UIStrings . turnOnForStyles , { PH1 : settingsLink } ) ;
13491347 }
13501348
1349+ return html `${ consentViewContents } ` ;
1350+ }
1351+
13511352function renderDisabledState ( contents : Lit . TemplateResult ) : Lit . TemplateResult {
13521353 // clang-format off
13531354 return html `
@@ -1475,11 +1476,11 @@ function renderMainContents({
14751476 markdownRenderer : MarkdownRendererWithCodeBlock ,
14761477 conversationType ?: ConversationType ,
14771478 changeSummary ?: string ,
1478- onSuggestionClick : ( suggestion : string ) => void ,
1479- onFeedbackSubmit : ( rpcId : Host . AidaClient . RpcGlobalId , rate : Host . AidaClient . Rating , feedback ?: string ) =>
1480- void ,
1481- onLastAnswerMarkdownViewRef : ( el : Element | undefined ) => void ,
1482- onMessageContainerRef : ( el : Element | undefined ) => void ,
1479+ onSuggestionClick : ( suggestion : string ) => void ,
1480+ onFeedbackSubmit :
1481+ ( rpcId : Host . AidaClient . RpcGlobalId , rate : Host . AidaClient . Rating , feedback ?: string ) => void ,
1482+ onLastAnswerMarkdownViewRef : ( el : Element | undefined ) => void ,
1483+ onMessageContainerRef : ( el : Element | undefined ) => void ,
14831484} ) : Lit . TemplateResult {
14841485 if ( state === State . CONSENT_VIEW ) {
14851486 return renderDisabledState ( renderConsentViewContents ( ) ) ;
0 commit comments