Add share target, prompt templates, command palette and session organisation
- PWA share target: shared text/links start a new chat or go into a
recent session (chooser dialog)
- Prompt templates (personal + global for admins) with {{placeholders}}
that are asked for on insert; managed under Settings → Templates
- Ctrl/Cmd+K command palette; Alt+N new session, Alt+Up/Down switch
sessions, Ctrl+, settings
- Sessions can be pinned, archived and filed into folders; the list can
be grouped by date or by project, groups are collapsible
- Fix: the "What's new" dialog was never shown to signed-in users
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b5de531d2e
commit
428e2df40a
25 files changed
+1106
-33
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import { get, put } from "./api";
|
||||
|
||||
export interface Template {
|
||||
id: string;
|
||||
name: string;
|
||||
text: string;
|
||||
}
|
||||
|
||||
export interface TemplateLists {
|
||||
personal: Template[];
|
||||
global: Template[];
|
||||
can_edit_global: boolean;
|
||||
}
|
||||
|
||||
export const loadTemplates = () => get<TemplateLists>("/templates");
|
||||
export const saveTemplates = (scope: "personal" | "global", list: Template[]) => put<Template[]>(`/templates/${scope}`, list);
|
||||
|
||||
/** Placeholders like {{file}} or {{goal: what should change}} (name, optional hint). */
|
||||
export function placeholders(text: string): { name: string; hint: string }[] {
|
||||
const seen = new Map<string, string>();
|
||||
for (const m of text.matchAll(/\{\{\s*([^}:]+?)\s*(?::\s*([^}]*?))?\s*\}\}/g)) {
|
||||
if (!seen.has(m[1])) seen.set(m[1], m[2] ?? "");
|
||||
}
|
||||
return [...seen].map(([name, hint]) => ({ name, hint }));
|
||||
}
|
||||
|
||||
export function fill(text: string, values: Record<string, string>): string {
|
||||
return text.replace(/\{\{\s*([^}:]+?)\s*(?::\s*([^}]*?))?\s*\}\}/g, (_, name: string) => values[name] ?? "");
|
||||
}
|
||||
Reference in new issue
Block a user