fix(ui): chat suggestions leave out prompts already asked in the conversation

This commit is contained in:
sam committed 2026-11-14 12:27:17 +11:00
1 parent 39bfde195c
commit b7b6078939
1 file changed
+7 -2
+7 -2
View File
@@ -4,7 +4,7 @@ import { computed, onUnmounted } from "vue";
import { useRoute } from "vue-router";
import { Button } from "@/components/ui/button";
import { chatModelReady, placeholderHint, sendMessage } from "./state";
import { chatModelReady, messages, placeholderHint, sendMessage } from "./state";
import { suggestionsForRoute } from "./suggestions";
/**
@@ -19,7 +19,12 @@ defineProps<{ list?: boolean }>();
const route = useRoute();
// No model, no prompts: one sent now could only fail.
const prompts = computed(() => (chatModelReady.value ? suggestionsForRoute(route) : []));
// A prompt already asked in this conversation is not suggested again.
const prompts = computed(() => {
if (!chatModelReady.value) return [];
const asked = new Set(messages.value.map((m) => m.text?.trim()));
return suggestionsForRoute(route).filter((p) => !asked.has(p));
});
function send(prompt: string): void {
placeholderHint.value = "";