feat(platform): Builder search history (#11457)

Preserve user searches in the new builder and cache search results for
more efficiency.
Search is saved, so the user can see their previous searches.

### Changes 🏗️

- Add `BuilderSearch` column&migration to save user search (with all
filters)
- Builder `db.py` now caches all search results using `@cached` and
returns paginated results, so following pages are returned much quicker
- Score and sort results
- Update models&routes
- Update frontend, so it works properly with modified endpoints
- Frontend: store `serachId` and use it for subsequent searches, so we
don't save partial searches (e.g. "b", "bl", ..., "block"). Search id is
reset when user clears the search field.
- Add clickable chips to the Suggestions builder tab
- Add `HorizontalScroll` component (chips use it)

### Checklist 📋

#### For code changes:
- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
  - [x] Search works and is cached
  - [x] Search sorts results
  - [x] Searches are preserved properly

---------

Co-authored-by: Reinier van der Leer <pwuts@agpt.co>
This commit is contained in:
Krzysztof Czerwinski
2025-12-11 02:32:17 +09:00
committed by GitHub
parent 7ff282c908
commit bd37fe946d
10 changed files with 710 additions and 173 deletions

View File

@@ -3662,7 +3662,18 @@
"required": false,
"schema": {
"anyOf": [
{ "type": "array", "items": { "type": "string" } },
{
"type": "array",
"items": {
"enum": [
"blocks",
"integrations",
"marketplace_agents",
"my_agents"
],
"type": "string"
}
},
{ "type": "null" }
],
"title": "Filter"
@@ -8612,6 +8623,45 @@
"required": ["name", "cron", "inputs"],
"title": "ScheduleCreationRequest"
},
"SearchEntry": {
"properties": {
"search_query": {
"anyOf": [{ "type": "string" }, { "type": "null" }],
"title": "Search Query"
},
"filter": {
"anyOf": [
{
"items": {
"type": "string",
"enum": [
"blocks",
"integrations",
"marketplace_agents",
"my_agents"
]
},
"type": "array"
},
{ "type": "null" }
],
"title": "Filter"
},
"by_creator": {
"anyOf": [
{ "items": { "type": "string" }, "type": "array" },
{ "type": "null" }
],
"title": "By Creator"
},
"search_id": {
"anyOf": [{ "type": "string" }, { "type": "null" }],
"title": "Search Id"
}
},
"type": "object",
"title": "SearchEntry"
},
"SearchResponse": {
"properties": {
"items": {
@@ -8625,6 +8675,7 @@
"type": "array",
"title": "Items"
},
"search_id": { "type": "string", "title": "Search Id" },
"total_items": {
"additionalProperties": { "type": "integer" },
"propertyNames": {
@@ -8638,11 +8689,10 @@
"type": "object",
"title": "Total Items"
},
"page": { "type": "integer", "title": "Page" },
"more_pages": { "type": "boolean", "title": "More Pages" }
"pagination": { "$ref": "#/components/schemas/Pagination" }
},
"type": "object",
"required": ["items", "total_items", "page", "more_pages"],
"required": ["items", "search_id", "total_items", "pagination"],
"title": "SearchResponse"
},
"SessionDetailResponse": {
@@ -9199,7 +9249,7 @@
"title": "Otto Suggestions"
},
"recent_searches": {
"items": { "type": "string" },
"items": { "$ref": "#/components/schemas/SearchEntry" },
"type": "array",
"title": "Recent Searches"
},