mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-09-04 10:11:46 +03:00
refactor: remove remaining dead code
This commit is contained in:
@@ -9,10 +9,10 @@ import type { WebUIIngressLimits } from "@/lib/types";
|
||||
* - ``ready`` — ``dataUrl`` available; safe to submit
|
||||
* - ``error`` — validation / decode failure; chip shows inline error
|
||||
*/
|
||||
export type AttachmentStatus = "encoding" | "ready" | "error";
|
||||
type AttachmentStatus = "encoding" | "ready" | "error";
|
||||
export type AttachmentKind = "image" | "file";
|
||||
|
||||
export interface AttachedAttachment {
|
||||
interface AttachedAttachment {
|
||||
id: string;
|
||||
kind: AttachmentKind;
|
||||
file: File;
|
||||
@@ -32,7 +32,7 @@ export interface AttachedAttachment {
|
||||
|
||||
export type AttachedImage = AttachedAttachment;
|
||||
|
||||
export interface RestoredReadyAttachment {
|
||||
interface RestoredReadyAttachment {
|
||||
dataUrl: string;
|
||||
name?: string;
|
||||
kind?: AttachmentKind;
|
||||
@@ -55,8 +55,8 @@ export type AttachmentError =
|
||||
| "io"; // file read failed at the browser layer
|
||||
|
||||
export const MAX_ATTACHMENTS_PER_MESSAGE = 4;
|
||||
export const MAX_ATTACHMENT_BYTES = 6 * 1024 * 1024;
|
||||
export const MAX_TOTAL_ATTACHMENT_BYTES = 24 * 1024 * 1024;
|
||||
const MAX_ATTACHMENT_BYTES = 6 * 1024 * 1024;
|
||||
const MAX_TOTAL_ATTACHMENT_BYTES = 24 * 1024 * 1024;
|
||||
|
||||
/** MIME whitelist — mirrors the server's and the ``<input accept>`` attr. */
|
||||
const ACCEPTED_IMAGE_MIMES: ReadonlySet<string> = new Set([
|
||||
|
||||
@@ -11,7 +11,7 @@ import { acceptedAttachmentKind } from "@/hooks/useAttachedImages";
|
||||
* - Plain text pasted alongside attachments is *not* consumed by this helper,
|
||||
* so the caller can still let the textarea receive it naturally.
|
||||
*/
|
||||
export function extractImageFilesFromPaste(
|
||||
function extractImageFilesFromPaste(
|
||||
event: ClipboardEvent | React.ClipboardEvent,
|
||||
): File[] {
|
||||
const clipboard = (event as ClipboardEvent).clipboardData
|
||||
@@ -27,7 +27,7 @@ export function extractImageFilesFromPaste(
|
||||
}
|
||||
|
||||
/** Extract dropped attachment files, mirroring ``extractImageFilesFromPaste``. */
|
||||
export function extractImageFilesFromDrop(
|
||||
function extractImageFilesFromDrop(
|
||||
event: DragEvent | React.DragEvent,
|
||||
): File[] {
|
||||
const dt = (event as DragEvent).dataTransfer
|
||||
|
||||
@@ -5,7 +5,7 @@ import { normalizeWorkbenchState } from "@/components/workbench/workbench-model"
|
||||
import { fetchSidebarState } from "@/lib/api";
|
||||
import type { ChatSummary, SidebarStatePayload } from "@/lib/types";
|
||||
|
||||
export const DEFAULT_SIDEBAR_STATE: SidebarStatePayload = {
|
||||
const DEFAULT_SIDEBAR_STATE: SidebarStatePayload = {
|
||||
schema_version: 1,
|
||||
pinned_keys: [],
|
||||
archived_keys: [],
|
||||
@@ -74,7 +74,7 @@ function boolMap(value: unknown): Record<string, boolean> {
|
||||
return out;
|
||||
}
|
||||
|
||||
export function normalizeSidebarState(raw: unknown): SidebarStatePayload {
|
||||
function normalizeSidebarState(raw: unknown): SidebarStatePayload {
|
||||
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
||||
return { ...DEFAULT_SIDEBAR_STATE, view: { ...DEFAULT_SIDEBAR_STATE.view } };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user