Merge branch 'master' into feat/ai-lab

This commit is contained in:
Tienson Qin
2023-04-27 11:28:54 +08:00
214 changed files with 5249 additions and 2949 deletions

View File

@@ -197,6 +197,7 @@
:plugin/marketplace-stats nil
:plugin/installing nil
:plugin/active-readme nil
:plugin/updates-auto-checking? false
:plugin/updates-pending {}
:plugin/updates-coming {}
:plugin/updates-downloading? false
@@ -269,7 +270,6 @@
:file/rename-event-chan (async/chan 100)
:ui/find-in-page nil
:ui/ai-dialog nil
:graph/importing nil
:graph/importing-state {}
@@ -277,6 +277,9 @@
:whiteboard/onboarding-tour? (or (storage/get :whiteboard-onboarding-tour?) false)
:whiteboard/last-persisted-at {}
:whiteboard/pending-tx-data {}
:history/page-only-mode? false
;; AI related
:open-ai/token (storage/get :open-ai-token)})))
;; Block ast state
@@ -633,9 +636,9 @@ Similar to re-frame subscriptions"
(distinct)))
(defn sub-block-selected?
[block-uuid]
[container-id block-uuid]
(rum/react
(rum/derived-atom [state] [::select-block block-uuid]
(rum/derived-atom [state] [::select-block container-id block-uuid]
(fn [state]
(contains? (set (get-selected-block-ids (:selection/blocks state)))
block-uuid)))))
@@ -1837,8 +1840,7 @@ Similar to re-frame subscriptions"
(defn feature-http-server-enabled?
[]
(and (developer-mode?)
(storage/get ::storage-spec/http-server-enabled)))
(boolean (storage/get ::storage-spec/http-server-enabled)))
(defn get-plugin-by-id
[id]
@@ -1851,7 +1853,7 @@ Similar to re-frame subscriptions"
(filterv
#(and (if include-unpacked? true (:iir %))
(if-not (boolean? enabled?) true (= (not enabled?) (boolean (get-in % [:settings :disabled]))))
(or include-all? (= (boolean theme?) (:theme %))))
(or include-all? (if (boolean? theme?) (= (boolean theme?) (:theme %)) true)))
(vals (:plugin/installed-plugins @state)))))
(defn lsp-enabled?-or-theme
@@ -1861,17 +1863,18 @@ Similar to re-frame subscriptions"
(def lsp-enabled?
(lsp-enabled?-or-theme))
(defn consume-updates-coming-plugin
(defn consume-updates-from-coming-plugin!
[payload updated?]
(when-let [id (keyword (:id payload))]
(let [pending? (boolean (seq (:plugin/updates-pending @state)))]
(let [prev-pending? (boolean (seq (:plugin/updates-pending @state)))]
(println "Updates: consumed pending - " id)
(swap! state update :plugin/updates-pending dissoc id)
(if updated?
(if-let [error (:error-code payload)]
(swap! state update-in [:plugin/updates-coming id] assoc :error-code error)
(swap! state update :plugin/updates-coming dissoc id))
(swap! state update :plugin/updates-coming assoc id payload))
(pub-event! [:plugin/consume-updates id pending? updated?]))))
(pub-event! [:plugin/consume-updates id prev-pending? updated?]))))
(defn coming-update-new-version?
[pkg]
@@ -1883,9 +1886,9 @@ Similar to re-frame subscriptions"
(coming-update-new-version? pkg)))
(defn all-available-coming-updates
[]
(when-let [updates (vals (:plugin/updates-coming @state))]
(filterv #(coming-update-new-version? %) updates)))
([] (all-available-coming-updates (:plugin/updates-coming @state)))
([updates] (when-let [updates (vals updates)]
(filterv #(coming-update-new-version? %) updates))))
(defn get-next-selected-coming-update
[]
@@ -1905,6 +1908,7 @@ Similar to re-frame subscriptions"
(defn reset-all-updates-state
[]
(swap! state assoc
:plugin/updates-auto-checking? false
:plugin/updates-pending {}
:plugin/updates-coming {}
:plugin/updates-downloading? false))