MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / push

Function push

apps/kimi-web/src/composables/useInputHistory.ts:70–84  ·  view source on GitHub ↗
(entry: string)

Source from the content-addressed store, hash-verified

68 let draftBeforeHistory = '';
69
70 function push(entry: string): void {
71 const sid = sessionId();
72 historyIndex = -1;
73 // Draft sessions have no id yet — drop the entry (see file header).
74 if (!sid) return;
75 const trimmed = entry.trim();
76 if (!trimmed) return;
77 const list = historyMap.value[sid] ?? [];
78 // Skip consecutive duplicates so repeated sends don't pad the history.
79 if (list.at(-1) === trimmed) return;
80 const next = [...list, trimmed];
81 const capped = next.length > MAX_HISTORY ? next.slice(-MAX_HISTORY) : next;
82 historyMap.value = { ...historyMap.value, [sid]: capped };
83 safeSetJson(STORAGE_KEYS.inputHistory, historyMap.value);
84 }
85
86 function caretAtTextStart(): boolean {
87 const el = textareaRef.value;

Callers

nothing calls this directly

Calls 1

safeSetJsonFunction · 0.90

Tested by

no test coverage detected