@@ -120,13 +120,16 @@ const AISearchDialog = {
120120 v-html="renderMarkdown(msg.content)"></div>
121121 <!-- Search Results -->
122122 <div v-if="getUniqueHits(msg.hits).length > 0" class="space-y-3 mt-3">
123- <div class="flex items-center gap-2">
123+ <div class="flex items-center justify-between gap-2">
124124 <p class="text-sm text-gray-600 dark:text-gray-400 font-semibold">{{ getUniqueHits(msg.hits).length }} Result{{ getUniqueHits(msg.hits).length !== 1 ? 's' : '' }} Found</p>
125+ <button type="button" @click="clearConversation" class="text-xs text-indigo-600 dark:text-indigo-400 hover:text-indigo-800 dark:hover:text-indigo-300 hover:underline font-semibold">
126+ clear
127+ </button>
125128 </div>
126- <a v-for="(hit, hitIdx) in getUniqueHits(msg.hits)" :key="hitIdx" :href="hit.url" :class="[hit.type ===
127- 'lvl0' || hit.type === 'lvl1' ?
128- 'bg-gradient-to-br from-indigo-50 to-indigo-100 dark:from-blue-900 dark:to-blue-800 border-blue-300 dark:border-blue-600' :
129- 'bg-gradient-to-br from-blue-50 to-blue-50 dark:from-blue-900 dark:to-blue-800 border-blue-300 dark:border-blue-600',
129+ <a v-for="(hit, hitIdx) in getUniqueHits(msg.hits)" :key="hitIdx" :href="hit.url" :class="[hit.type ===
130+ 'lvl0' || hit.type === 'lvl1' ?
131+ 'bg-gradient-to-br from-indigo-50 to-indigo-100 dark:from-blue-900 dark:to-blue-800 border-blue-300 dark:border-blue-600' :
132+ 'bg-gradient-to-br from-blue-50 to-blue-50 dark:from-blue-900 dark:to-blue-800 border-blue-300 dark:border-blue-600',
130133 'rounded-lg p-4 border hover:shadow-md transition-shadow cursor-pointer block']">
131134 <div :class="[hit.type === 'lvl0' || hit.type === 'lvl1' ? 'text-indigo-600 dark:text-indigo-400 hover:text-indigo-800 dark:hover:text-indigo-300 text-base' : 'text-blue-600 dark:text-indigo-400 hover:text-blue-800 dark:hover:text-indigo-300 text-sm', 'font-semibold']">
132135 {{ hit.title }}
@@ -138,6 +141,12 @@ const AISearchDialog = {
138141 {{ hit.content }}
139142 </p>
140143 </a>
144+ <!-- Clear Button After Results -->
145+ <div class="flex justify-center pt-2">
146+ <button type="button" @click="clearConversation" class="text-xs text-indigo-600 dark:text-indigo-400 hover:text-indigo-800 dark:hover:text-indigo-300 hover:underline font-semibold">
147+ clear
148+ </button>
149+ </div>
141150 </div>
142151 </div>
143152 </div>
@@ -180,12 +189,23 @@ const AISearchDialog = {
180189 if ( ! hits ) return [ ]
181190 const seen = new Set ( )
182191 return hits . filter ( hit => {
183- if ( seen . has ( hit . url ) ) return false
184- seen . add ( hit . url )
192+ const normalizedUrl = hit . url . replace ( / \. h t m l ( # | $ ) / , '$1' )
193+ if ( seen . has ( normalizedUrl ) ) return false
194+ seen . add ( normalizedUrl )
185195 return true
186196 } )
187197 }
188198
199+ function clearConversation ( ) {
200+ messages . value = [ ]
201+ inputMessage . value = ''
202+ conversationId . value = null
203+ loading . value = false
204+ nextTick ( ( ) => {
205+ refMessage . value ?. focus ( )
206+ } )
207+ }
208+
189209 async function sendMessage ( ) {
190210 if ( ! inputMessage . value . trim ( ) || loading . value ) return
191211
@@ -234,6 +254,7 @@ const AISearchDialog = {
234254 inputMessage,
235255 loading,
236256 sendMessage,
257+ clearConversation,
237258 renderMarkdown,
238259 getUniqueHits,
239260 }
0 commit comments