Skip to content

Commit

Permalink
fix(console): update chrome ai API
Browse files Browse the repository at this point in the history
  • Loading branch information
xmlking committed Sep 20, 2024
1 parent f272971 commit ebceb94
Show file tree
Hide file tree
Showing 6 changed files with 209 additions and 136 deletions.
2 changes: 1 addition & 1 deletion apps/console/src/ai.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Types from
* https://github.com/swissspidy/ai-experiments/blob/main/packages/editor/src/%40types/ai.d.ts
* https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/dom-chromium-ai/index.d.ts
*/

interface WindowOrWorkerGlobalScope {
Expand Down
4 changes: 2 additions & 2 deletions apps/console/src/lib/components/smart/assistant-stats.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script lang="ts">
import { getChromeAI } from '$lib/stores/chrome-ai';
const chromeAI = getChromeAI();
const { isAISupported, isAssistantReady, assistant, isLoading } = chromeAI;
const { isAISupported, assistantAvailability, assistant, isLoading } = chromeAI;
</script>

{#if $isAISupported && $isAssistantReady}
{#if isAISupported && $assistantAvailability === 'readily'}
<div class="my-12">
<div class="h2">Session stats</div>
<table class="table table-hover">
Expand Down
4 changes: 2 additions & 2 deletions apps/console/src/lib/components/smart/smart-date.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { default as LoaderIcon } from './loader-icon.svelte';
const log = new Logger('experiments:ai:ms:browser');
const api = '/api/date';
const { isAISupported, isAssistantReady } = getChromeAI();
const { isAISupported, assistantAvailability } = getChromeAI();
export let value = '';
let prompt = '';
Expand Down Expand Up @@ -87,7 +87,7 @@ const onSubmit = useLocalLocal;
<form
class="flex flex-col items-center"
on:submit|preventDefault={(event) => {
$isAssistantReady ? useLocalLocal(event) : useRemoteModel(event);
$assistantAvailability === 'readily' ? useLocalLocal(event) : useRemoteModel(event);
}}
>
<input
Expand Down
Loading

0 comments on commit ebceb94

Please sign in to comment.