feat: snip a region into chat, and make links clickable (#14)

This commit was merged in pull request #14.
This commit is contained in:
2026-10-05 08:38:50 +00:00
parent f5d1ced4d6
commit 576c5946f7
44 changed files with 3890 additions and 120 deletions
+8 -2
View File
@@ -1,7 +1,7 @@
import { LocalStorage } from "@vicinae/api";
import { MAX_SESSIONS, MAX_STORED_CHARS_PER_TURN, MAX_TURNS_PER_SESSION, STORAGE_INDEX_KEY, STORAGE_SESSION_PREFIX, TITLE_MAX_LENGTH } from "./constants";
import { SessionIndexSchema, SessionSchema } from "./schemas";
import type { ChatTurn, Session, SessionSummary } from "./types";
import type { Attachment, ChatTurn, Session, SessionSummary } from "./types";
import { titleFromPrompt, truncate } from "./utils";
/**
@@ -56,7 +56,12 @@ export function createSession(model: string, now: number = Date.now()): Session
}
/** Creates the turn record for a prompt that is about to be sent. */
export function createTurn(prompt: string, model: string, now: number = Date.now()): ChatTurn {
export function createTurn(
prompt: string,
model: string,
now: number = Date.now(),
attachments: Attachment[] = [],
): ChatTurn {
return {
id: newId(),
prompt,
@@ -65,6 +70,7 @@ export function createTurn(prompt: string, model: string, now: number = Date.now
model,
createdAt: now,
toolCalls: [],
attachments,
};
}