Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
chatbot canifa
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
chatbot canifa
Commits
d6a0dabb
Commit
d6a0dabb
authored
May 11, 2026
by
Vũ Hoàng Anh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(search): retrieve and parse both similar_items and outfit_recommendations
parent
9a233f6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
search_engine.py
backend/agent/tools/tool_module/search_engine.py
+16
-0
No files found.
backend/agent/tools/tool_module/search_engine.py
View file @
d6a0dabb
...
@@ -46,6 +46,7 @@ SELECT_COLUMNS = """
...
@@ -46,6 +46,7 @@ SELECT_COLUMNS = """
description_text,
description_text,
tags,
tags,
similar_items,
similar_items,
outfit_recommendations,
description_text_full
description_text_full
"""
"""
...
@@ -346,6 +347,20 @@ class SearchEngine:
...
@@ -346,6 +347,20 @@ class SearchEngine:
p
[
"similar_items"
]
=
[]
p
[
"similar_items"
]
=
[]
return
products
return
products
@
staticmethod
def
_parse_outfit_recommendations
(
products
:
list
)
->
list
:
"""Parse outfit_recommendations JSON string from One Big Table into list[dict]."""
for
p
in
products
:
raw
=
p
.
get
(
"outfit_recommendations"
)
if
raw
and
isinstance
(
raw
,
str
):
try
:
p
[
"outfit_recommendations"
]
=
json
.
loads
(
raw
)
except
(
json
.
JSONDecodeError
,
TypeError
):
p
[
"outfit_recommendations"
]
=
[]
elif
not
raw
:
p
[
"outfit_recommendations"
]
=
[]
return
products
async
def
search
(
self
,
literal
:
str
,
inferred
:
Dict
[
str
,
Any
],
check_stock
:
bool
=
True
)
->
Dict
[
str
,
Any
]:
async
def
search
(
self
,
literal
:
str
,
inferred
:
Dict
[
str
,
Any
],
check_stock
:
bool
=
True
)
->
Dict
[
str
,
Any
]:
inf
=
InferredSearch
(
**
inferred
)
inf
=
InferredSearch
(
**
inferred
)
_apply_event_fallback
(
inf
,
literal
)
_apply_event_fallback
(
inf
,
literal
)
...
@@ -364,6 +379,7 @@ class SearchEngine:
...
@@ -364,6 +379,7 @@ class SearchEngine:
if
products
:
if
products
:
if
check_stock
:
products
=
await
enrich_with_stock
(
products
)
if
check_stock
:
products
=
await
enrich_with_stock
(
products
)
products
=
self
.
_parse_similar_items
(
products
)
products
=
self
.
_parse_similar_items
(
products
)
products
=
self
.
_parse_outfit_recommendations
(
products
)
for
p
in
products
:
for
p
in
products
:
raw_size
=
p
.
get
(
"size_scale"
,
""
)
raw_size
=
p
.
get
(
"size_scale"
,
""
)
parsed
=
[
s
.
strip
()
for
s
in
str
(
raw_size
)
.
replace
(
"["
,
""
)
.
replace
(
"]"
,
""
)
.
replace
(
'"'
,
''
)
.
split
(
","
)
if
s
.
strip
()]
parsed
=
[
s
.
strip
()
for
s
in
str
(
raw_size
)
.
replace
(
"["
,
""
)
.
replace
(
"]"
,
""
)
.
replace
(
'"'
,
''
)
.
split
(
","
)
if
s
.
strip
()]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment