chore: remove unused dead code
This commit is contained in:
@@ -12,7 +12,6 @@ import {
|
||||
} from "@/workers/imageEncode.worker";
|
||||
|
||||
export type { EncodeResponse, EncodeSuccess, EncodeFailure } from "@/workers/imageEncode.worker";
|
||||
export { TARGET_MAX_BYTES } from "@/workers/imageEncode.worker";
|
||||
|
||||
type Pending = {
|
||||
resolve: (r: EncodeResponse) => void;
|
||||
@@ -82,16 +81,3 @@ export async function encodeImage(file: File): Promise<EncodeResponse> {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Release the singleton Worker (tests / teardown). */
|
||||
export function disposeImageEncoder(): void {
|
||||
if (worker) {
|
||||
worker.terminate();
|
||||
worker = null;
|
||||
}
|
||||
bootAttempted = false;
|
||||
for (const [, entry] of pending) {
|
||||
entry.reject(new Error("image encoder disposed"));
|
||||
}
|
||||
pending.clear();
|
||||
}
|
||||
|
||||
@@ -1,26 +1,5 @@
|
||||
import type { ToolProgressEvent } from "@/lib/types";
|
||||
|
||||
/** Drop duplicate tool_call objects (same id or identical formatted trace). */
|
||||
export function dedupeToolCallsForUi(calls: unknown): unknown[] {
|
||||
if (!Array.isArray(calls) || calls.length === 0) return [];
|
||||
const seen = new Set<string>();
|
||||
const out: unknown[] = [];
|
||||
for (const c of calls) {
|
||||
let key: string | null = null;
|
||||
if (c && typeof c === "object" && "id" in c) {
|
||||
const id = (c as { id?: unknown }).id;
|
||||
if (typeof id === "string" && id.length > 0) key = `id:${id}`;
|
||||
}
|
||||
if (key == null) {
|
||||
key = formatToolCallTrace(c) ?? "";
|
||||
}
|
||||
if (!key || seen.has(key)) continue;
|
||||
seen.add(key);
|
||||
out.push(c);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
export function formatToolCallTrace(call: unknown): string | null {
|
||||
if (!call || typeof call !== "object") return null;
|
||||
const item = call as {
|
||||
|
||||
Reference in New Issue
Block a user