mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
enhance: index embedding for updated blocks every 30s
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
(:require [frontend.common.missionary :as c.m]
|
||||
[frontend.config :as config]
|
||||
[frontend.flows :as flows]
|
||||
[frontend.handler.db-based.vector-search-flows :as vector-search-flows]
|
||||
[frontend.state :as state]
|
||||
[missionary.core :as m]
|
||||
[promesa.core :as p]))
|
||||
[missionary.core :as m]))
|
||||
|
||||
(defn- run-background-task-when-not-publishing
|
||||
[key' task]
|
||||
@@ -15,7 +15,14 @@
|
||||
(run-background-task-when-not-publishing
|
||||
::init-load-model-when-switch-graph
|
||||
(m/reduce
|
||||
(fn [_ repo]
|
||||
(when repo
|
||||
(state/<invoke-db-worker :thread-api/vec-search-init-embedding-model repo)))
|
||||
flows/current-repo-flow))
|
||||
(constantly nil)
|
||||
(m/ap
|
||||
(m/?> vector-search-flows/infer-worker-ready-flow)
|
||||
(when-let [repo (m/?< flows/current-repo-flow)]
|
||||
(c.m/<? (state/<invoke-db-worker :thread-api/vec-search-init-embedding-model repo))
|
||||
(m/?
|
||||
(m/reduce
|
||||
(fn []
|
||||
(state/<invoke-db-worker :thread-api/vec-search-embedding-graph repo))
|
||||
;; index new updates every 30s
|
||||
(c.m/clock (* 30 1000))))))))
|
||||
|
||||
Reference in New Issue
Block a user