feat: add llm_query_builder to SessionFeatures and populateFromLLM to search store
This commit is contained in:
parent
cdc4e40775
commit
65ddd2f4fa
2 changed files with 32 additions and 0 deletions
|
|
@ -61,6 +61,18 @@ export interface SavedSearch {
|
||||||
last_run_at: string | null
|
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 {
|
export interface SearchFilters {
|
||||||
minTrustScore?: number
|
minTrustScore?: number
|
||||||
minPrice?: number
|
minPrice?: number
|
||||||
|
|
@ -120,6 +132,7 @@ export const useSearchStore = defineStore('search', () => {
|
||||||
)
|
)
|
||||||
const marketPrice = ref<number | null>(cached?.marketPrice ?? null)
|
const marketPrice = ref<number | null>(cached?.marketPrice ?? null)
|
||||||
const adapterUsed = ref<'api' | 'scraper' | null>(cached?.adapterUsed ?? null)
|
const adapterUsed = ref<'api' | 'scraper' | null>(cached?.adapterUsed ?? null)
|
||||||
|
const filters = ref<SearchFilters>({})
|
||||||
const affiliateActive = ref<boolean>(false)
|
const affiliateActive = ref<boolean>(false)
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const error = ref<string | null>(null)
|
const error = ref<string | null>(null)
|
||||||
|
|
@ -281,6 +294,21 @@ export const useSearchStore = defineStore('search', () => {
|
||||||
error.value = null
|
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 {
|
return {
|
||||||
query,
|
query,
|
||||||
results,
|
results,
|
||||||
|
|
@ -292,10 +320,12 @@ export const useSearchStore = defineStore('search', () => {
|
||||||
loading,
|
loading,
|
||||||
enriching,
|
enriching,
|
||||||
error,
|
error,
|
||||||
|
filters,
|
||||||
search,
|
search,
|
||||||
cancelSearch,
|
cancelSearch,
|
||||||
enrichSeller,
|
enrichSeller,
|
||||||
closeUpdates,
|
closeUpdates,
|
||||||
clearResults,
|
clearResults,
|
||||||
|
populateFromLLM,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ export interface SessionFeatures {
|
||||||
photo_analysis: boolean
|
photo_analysis: boolean
|
||||||
shared_scammer_db: boolean
|
shared_scammer_db: boolean
|
||||||
shared_image_db: boolean
|
shared_image_db: boolean
|
||||||
|
llm_query_builder: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const LOCAL_FEATURES: SessionFeatures = {
|
const LOCAL_FEATURES: SessionFeatures = {
|
||||||
|
|
@ -22,6 +23,7 @@ const LOCAL_FEATURES: SessionFeatures = {
|
||||||
photo_analysis: true,
|
photo_analysis: true,
|
||||||
shared_scammer_db: true,
|
shared_scammer_db: true,
|
||||||
shared_image_db: true,
|
shared_image_db: true,
|
||||||
|
llm_query_builder: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useSessionStore = defineStore('session', () => {
|
export const useSessionStore = defineStore('session', () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue