mirror of
https://github.com/DustinBrett/daedalOS.git
synced 2025-12-06 00:20:05 +01:00
Don't use "assistant" api anymore
This commit is contained in:
parent
e5f1167bcc
commit
b22a3bf72f
|
|
@ -74,7 +74,7 @@ globalThis.addEventListener(
|
|||
systemPrompt: SYSTEM_PROMPT.content,
|
||||
};
|
||||
|
||||
session = await globalThis.ai.assistant.create(config);
|
||||
session = await globalThis.ai.languageModel.create(config);
|
||||
} else {
|
||||
session = [SYSTEM_PROMPT];
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { type MarkedOptions } from "components/apps/Marked/useMarked";
|
|||
|
||||
declare global {
|
||||
/* eslint-disable vars-on-top, no-var */
|
||||
var ai: { assistant: AIAssistantFactory };
|
||||
var ai: { languageModel: AIAssistantFactory };
|
||||
var marked: {
|
||||
parse: (markdownString: string, options: MarkedOptions) => string;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,17 +6,17 @@ const supportsAI = async (): Promise<boolean> => {
|
|||
if (
|
||||
typeof window === "undefined" ||
|
||||
!("ai" in window) ||
|
||||
!("assistant" in window.ai) ||
|
||||
typeof window.ai.assistant !== "object" ||
|
||||
!("capabilities" in window.ai.assistant) ||
|
||||
typeof window.ai.assistant.capabilities !== "function"
|
||||
!("languageModel" in window.ai) ||
|
||||
typeof window.ai.languageModel !== "object" ||
|
||||
!("capabilities" in window.ai.languageModel) ||
|
||||
typeof window.ai.languageModel.capabilities !== "function"
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
HAS_WINDOW_AI =
|
||||
(await window.ai.assistant.capabilities()).available === "readily";
|
||||
(await window.ai.languageModel.capabilities()).available === "readily";
|
||||
|
||||
return HAS_WINDOW_AI;
|
||||
} catch {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user