From 65ddd2f4fafe3c8b6db58068d55c0f7bd43af6d5 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Tue, 14 Apr 2026 11:49:22 -0700 Subject: [PATCH] feat: add llm_query_builder to SessionFeatures and populateFromLLM to search store --- web/src/stores/search.ts | 30 ++++++++++++++++++++++++++++++ web/src/stores/session.ts | 2 ++ 2 files changed, 32 insertions(+) diff --git a/web/src/stores/search.ts b/web/src/stores/search.ts index 3fca4f8..042e4c0 100644 --- a/web/src/stores/search.ts +++ b/web/src/stores/search.ts @@ -61,6 +61,18 @@ export interface SavedSearch { last_run_at: string | null } +export interface SearchParamsResult { + base_query: string + must_include_mode: string + must_include: string + must_exclude: string + max_price: number | null + min_price: number | null + condition: string[] + category_id: string | null + explanation: string +} + export interface SearchFilters { minTrustScore?: number minPrice?: number @@ -120,6 +132,7 @@ export const useSearchStore = defineStore('search', () => { ) const marketPrice = ref(cached?.marketPrice ?? null) const adapterUsed = ref<'api' | 'scraper' | null>(cached?.adapterUsed ?? null) + const filters = ref({}) const affiliateActive = ref(false) const loading = ref(false) const error = ref(null) @@ -281,6 +294,21 @@ export const useSearchStore = defineStore('search', () => { error.value = null } + function populateFromLLM(params: SearchParamsResult) { + query.value = params.base_query + const mode = params.must_include_mode as MustIncludeMode + filters.value = { + ...filters.value, + mustInclude: params.must_include, + mustIncludeMode: mode, + mustExclude: params.must_exclude, + maxPrice: params.max_price ?? undefined, + minPrice: params.min_price ?? undefined, + conditions: params.condition.length > 0 ? params.condition : undefined, + categoryId: params.category_id ?? undefined, + } + } + return { query, results, @@ -292,10 +320,12 @@ export const useSearchStore = defineStore('search', () => { loading, enriching, error, + filters, search, cancelSearch, enrichSeller, closeUpdates, clearResults, + populateFromLLM, } }) diff --git a/web/src/stores/session.ts b/web/src/stores/session.ts index 2cf32ec..570d0e2 100644 --- a/web/src/stores/session.ts +++ b/web/src/stores/session.ts @@ -11,6 +11,7 @@ export interface SessionFeatures { photo_analysis: boolean shared_scammer_db: boolean shared_image_db: boolean + llm_query_builder: boolean } const LOCAL_FEATURES: SessionFeatures = { @@ -22,6 +23,7 @@ const LOCAL_FEATURES: SessionFeatures = { photo_analysis: true, shared_scammer_db: true, shared_image_db: true, + llm_query_builder: true, } export const useSessionStore = defineStore('session', () => {