mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-18 07:01:30 +00:00
Enable more biome lints and fix things
This commit is contained in:
parent
9c18439c4d
commit
d5fd685901
57 changed files with 151 additions and 199 deletions
|
|
@ -40,18 +40,18 @@ export class AttachmentsRuntimeProvider implements SandboxRuntimeProvider {
|
|||
|
||||
(window as any).readTextAttachment = (attachmentId: string) => {
|
||||
const a = ((window as any).attachments || []).find((x: any) => x.id === attachmentId);
|
||||
if (!a) throw new Error("Attachment not found: " + attachmentId);
|
||||
if (!a) throw new Error(`Attachment not found: ${attachmentId}`);
|
||||
if (a.extractedText) return a.extractedText;
|
||||
try {
|
||||
return atob(a.content);
|
||||
} catch {
|
||||
throw new Error("Failed to decode text content for: " + attachmentId);
|
||||
throw new Error(`Failed to decode text content for: ${attachmentId}`);
|
||||
}
|
||||
};
|
||||
|
||||
(window as any).readBinaryAttachment = (attachmentId: string) => {
|
||||
const a = ((window as any).attachments || []).find((x: any) => x.id === attachmentId);
|
||||
if (!a) throw new Error("Attachment not found: " + attachmentId);
|
||||
if (!a) throw new Error(`Attachment not found: ${attachmentId}`);
|
||||
const bin = atob(a.content);
|
||||
const bytes = new Uint8Array(bin.length);
|
||||
for (let i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue