Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/app/components/event-row/event-row.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,12 @@
}
<!-- Feedback UI -->
@if(isUserFeedbackEnabled && !isLoadingAgentResponse && uiEvent.role === "bot") {
<app-message-feedback [sessionName]="sessionName" [eventId]="uiEvent.event.id || ''"></app-message-feedback>
@if (!messageFeedbackComponent) {
<app-message-feedback [sessionName]="sessionName" [eventId]="uiEvent.event.id || ''"></app-message-feedback>
} @else {
<ng-container
[ngComponentOutlet]="messageFeedbackComponent"
[ngComponentOutletInputs]="{sessionName: sessionName, eventId: uiEvent.event.id || ''}"
></ng-container>
}
}
6 changes: 5 additions & 1 deletion src/app/components/event-row/event-row.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
*/

import {CommonModule} from '@angular/common';
import {Component, EventEmitter, Input, Output} from '@angular/core';
import {Component, EventEmitter, Input, Output, inject} from '@angular/core';

import {AgentRunRequest} from '../../core/models/AgentRunRequest';
import type {EvalCase} from '../../core/models/Eval';
import {UiEvent} from '../../core/models/UiEvent';
import {ChatAvatarComponent} from '../chat-avatar/chat-avatar.component';
import {MessageFeedbackComponent} from '../message-feedback/message-feedback.component';
import {EventContentComponent} from '../event-content/event-content.component';
import {MESSAGE_FEEDBACK_COMPONENT} from '../message-feedback/message-feedback.component.interface';

@Component({
selector: 'app-event-row',
Expand All @@ -46,6 +47,9 @@ import {EventContentComponent} from '../event-content/event-content.component';
],
})
export class EventRowComponent {
protected readonly messageFeedbackComponent =
inject(MESSAGE_FEEDBACK_COMPONENT, {optional: true});

@Input({required: true}) uiEvent!: UiEvent;
@Input({required: true}) index!: number;
@Input() uiEvents: UiEvent[] = [];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* @license
* Copyright 2026 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import {InjectionToken, InputSignal, Type} from '@angular/core';

/**
* Represents a component to be used to collect feedback on a message, in place
* of the built-in one. Feedback UX varies by product, and an embedder already
* supplies the feedback backend through `FEEDBACK_SERVICE`.
*/
export const MESSAGE_FEEDBACK_COMPONENT =
new InjectionToken<Type<MessageFeedbackComponentInterface>>(
'MESSAGE_FEEDBACK_COMPONENT',
);

/**
* Interface for the message feedback component. The message is identified by
* the session it belongs to and the event that carries it.
*/
export interface MessageFeedbackComponentInterface {
sessionName: InputSignal<string>;
eventId: InputSignal<string>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {MatTooltipModule} from '@angular/material/tooltip';
import {Feedback, FEEDBACK_SERVICE} from '../../core/services/interfaces/feedback';

import {MessageFeedbackMessagesInjectionToken} from './message-feedback.component.i18n';
import {MessageFeedbackComponentInterface} from './message-feedback.component.interface';

@Component({
changeDetection: ChangeDetectionStrategy.Default,
Expand All @@ -47,7 +48,7 @@ import {MessageFeedbackMessagesInjectionToken} from './message-feedback.componen
MatTooltipModule,
],
})
export class MessageFeedbackComponent {
export class MessageFeedbackComponent implements MessageFeedbackComponentInterface {
sessionName = input.required<string>();
eventId = input.required<string>();

Expand Down
Loading