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: 2 additions & 7 deletions src/app/components/artifact-tab/artifact-tab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,8 @@ const DEFAULT_ARTIFACT_NAME = 'default_artifact_name';
/**
* The supported media types for artifacts.
*/
export enum MediaType {
IMAGE = 'image',
AUDIO = 'audio',
VIDEO = 'video',
TEXT = 'text', // for text/html
UNSPECIFIED = 'unspecified',
}
import { MediaType } from '../../core/models/types';
export { MediaType };

/*
* Returns the media type from the mime type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

// 1p-ONLY-IMPORTS: import {beforeEach, describe, expect, it}
import {initTestBed} from '../../testing/utils';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
Expand All @@ -34,6 +36,7 @@ describe('SystemInstructionDiffDialogComponent', () => {
beforeEach(async () => {
mockDialogRef = jasmine.createSpyObj('MatDialogRef', ['close']);

initTestBed(); // required for 1p compat
await TestBed.configureTestingModule({
imports: [SystemInstructionDiffDialogComponent, NoopAnimationsModule],
providers: [
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/models/UiEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import { ExecutableCode, CodeExecutionResult, FunctionCall, FunctionResponse, Event } from './types';
import { MediaType } from '../../components/artifact-tab/artifact-tab.component';
import { MediaType } from './types';

export class UiEvent {
role!: 'user' | 'bot' | string;
Expand Down
2 changes: 2 additions & 0 deletions src/app/core/models/trace.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

// 1p-ONLY-IMPORTS: import {beforeEach, describe, expect, it}
import {initTestBed} from '../../testing/utils';
import {
FallbackSpan,
GenerateContentSpan,
Expand Down
2 changes: 2 additions & 0 deletions src/app/core/models/trace/ExperimentalSemconv.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

// 1p-ONLY-IMPORTS: import {beforeEach, describe, expect, it}
import {initTestBed} from '../../../testing/utils';
import {
CompletionDetailsLogValidator,
GEN_AI_COMPLETION_DETAILS_EVENT,
Expand Down
2 changes: 2 additions & 0 deletions src/app/core/models/trace/StableSemconv.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

// 1p-ONLY-IMPORTS: import {beforeEach, describe, expect, it}
import {initTestBed} from '../../../testing/utils';
import {
GEN_AI_CHOICE_EVENT,
GEN_AI_SYSTEM_MESSAGE_EVENT,
Expand Down
8 changes: 8 additions & 0 deletions src/app/core/models/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,11 @@ export interface ComputerUsePayload {
image?: {data: string; mimetype?: string;};
url?: string;
}

export enum MediaType {
IMAGE = 'image',
AUDIO = 'audio',
VIDEO = 'video',
TEXT = 'text',
UNSPECIFIED = 'unspecified',
}
3 changes: 3 additions & 0 deletions src/app/core/services/analytics.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

// 1p-ONLY-IMPORTS: import {beforeEach, describe, expect, it}
import {initTestBed} from '../../testing/utils';
import { TestBed } from '@angular/core/testing';
import { signal } from '@angular/core';
import { AnalyticsService, DEFAULT_GA_MEASUREMENT_ID } from './analytics.service';
Expand All @@ -31,6 +33,7 @@ describe('AnalyticsService', () => {
telemetryEnabled: signal(false),
};

initTestBed(); // required for 1p compat
TestBed.configureTestingModule({
providers: [
AnalyticsService,
Expand Down
4 changes: 3 additions & 1 deletion src/app/core/services/analytics.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

import { inject, Injectable, effect } from '@angular/core';
import { TelemetryService } from './telemetry.service';
import {setScriptSrc} from 'safevalues/dom';
import {trustedResourceUrl} from 'safevalues';

declare global {
interface Window {
Expand Down Expand Up @@ -66,7 +68,7 @@ export class AnalyticsService {
// Load GA4 script
const script = document.createElement('script');
script.async = true;
script.src = `https://www.googletagmanager.com/gtag/js?id=${this.measurementId}`;
setScriptSrc(script, trustedResourceUrl`https://www.googletagmanager.com/gtag/js?id=${this.measurementId}`);
document.head.appendChild(script);

window.gtag('js', new Date());
Expand Down
13 changes: 9 additions & 4 deletions src/app/core/services/theme.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

import { Injectable, signal, effect } from '@angular/core';
import { ThemeServiceInterface, Theme } from './interfaces/theme';
import {setLinkHrefAndRel} from 'safevalues/dom';
import {trustedResourceUrl} from 'safevalues';

@Injectable({
providedIn: 'root'
Expand Down Expand Up @@ -65,15 +67,18 @@ export class ThemeService implements ThemeServiceInterface {
}

private updatePrismTheme(theme: Theme): void {
const linkId = 'prism-theme-style';
const linkId = "prism-theme-style";
let linkElement = document.getElementById(linkId) as HTMLLinkElement;
if (!linkElement) {
linkElement = document.createElement('link');
linkElement = document.createElement("link");
linkElement.id = linkId;
linkElement.rel = 'stylesheet';
document.head.appendChild(linkElement);
}
linkElement.href = theme === 'light' ? 'prism-light.css' : 'prism-dark.css';
setLinkHrefAndRel(
linkElement,
theme === "light" ? trustedResourceUrl`prism-light.css` : trustedResourceUrl`prism-dark.css`,
"stylesheet",
);
}

toggleTheme(): void {
Expand Down
2 changes: 2 additions & 0 deletions src/app/core/utils/audio.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

// 1p-ONLY-IMPORTS: import {beforeEach, describe, expect, it}
import {initTestBed} from '../../testing/utils';
import {base64ToArrayBuffer, pcmChunksToWavBase64} from './audio';

/** Decodes base64 -> Uint8Array for assertions. */
Expand Down
1 change: 1 addition & 0 deletions src/assets/audio-processor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/**
* @license
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Loading