fix(ui): one insert chip per earlier step, inserting its summary

This commit is contained in:
sam committed 2026-10-18 23:45:24 +11:00
1 parent 0a59ef113c
commit 6c8d1df625
1 file changed
+3 -6
+3 -6
View File
@@ -128,11 +128,11 @@ const matching = (list: [string, InputSpec][], spec: InputSpec, prefix: string)
// A reference goes into the text setting last focused: that is how this step
// is connected to an earlier step's result.
const focused = ref<string | null>(null);
function reference(id: string, field: "summary" | "result"): void {
function reference(id: string): void {
const key = focused.value ?? fields.value.lead?.key;
if (!key) return;
const current = typeof settings.value[key] === "string" ? (settings.value[key] as string) : "";
const token = `{{ steps.${id}.${field} }}`;
const token = `{{ steps.${id}.summary }}`;
setSetting(key, current ? `${current.trimEnd()} ${token}` : token);
}
@@ -196,10 +196,7 @@ const ON_FAILURE = [{ value: "", label: "Park the task" }, { value: "continue",
/>
<div v-if="earlier.length && fields.lead.kind !== 'select'" class="flex flex-wrap items-center gap-1 pt-0.5">
<span class="text-[11px] text-fg-subtle">Insert</span>
<template v-for="id in earlier" :key="id">
<Button type="button" variant="outline" size="xs" class="font-mono" @click="reference(id, 'summary')">{{ id }}</Button>
<Button type="button" variant="outline" size="xs" class="font-mono" @click="reference(id, 'result')">{{ id }}.result</Button>
</template>
<Button v-for="id in earlier" :key="id" type="button" variant="outline" size="xs" class="font-mono" :title="`{{ steps.${id}.summary }}`" @click="reference(id)">{{ id }}</Button>
</div>
</section>