Neural-Brain integriert

This commit is contained in:
2026-08-04 21:14:40 +02:00
parent dc369dab65
commit 5f870912a3
2 changed files with 100 additions and 1 deletions
+10 -1
View File
@@ -11,8 +11,10 @@ import (
"os"
"strconv"
"strings"
"time"
"kb-editor/internal/aifallback"
"kb-editor/internal/brainactivity"
"kb-editor/internal/staging"
"kb-editor/internal/store"
)
@@ -131,8 +133,15 @@ func (a *app) handleList(w http.ResponseWriter, r *http.Request) {
}
func (a *app) handleSearch(w http.ResponseWriter, r *http.Request) {
startedAt := time.Now()
q := queryFromURL(r)
writeJSON(w, http.StatusOK, a.store.Search(q))
result := a.store.Search(q)
hits := make([]brainactivity.Hit, 0, len(result.Items))
for _, hit := range result.Items {
hits = append(hits, brainactivity.Hit{ID: hit.ID, Score: float64(hit.Score) / 100})
}
brainactivity.EmitSearch("knowledgebase", q.Q, hits, time.Since(startedAt))
writeJSON(w, http.StatusOK, result)
}
func (a *app) handleFacets(w http.ResponseWriter, r *http.Request) {