线程元数据存储 —— SQLite 后端(designs/agui-borrow.md §6)。按需加载: 不 require 本 ns 就不碰 JDBC。
零新依赖:next.jdbc / sqlite-jdbc 本来就是 clj-agent-client 的依赖
(im.ttalk.agent.memory.sqlite 在用),本模块依赖 client,传递可得。
可以与 memory.sqlite 共用一个库文件(表名不撞)——于是重启之后侧栏的线程
列表与点进去看到的历史出自同一个文件。
表结构: agui_threads(id TEXT PK, agent_id TEXT, name TEXT, archived INTEGER, created_at INTEGER, updated_at INTEGER)
⛔ 只存元数据,不存消息与事件(见 agui.thread-store 的 ns docstring)。
(require '[im.ttalk.agent.agui.thread-store.sqlite :as ts-sqlite])
(def store (ts-sqlite/sqlite-thread-store "agent.db"))
线程元数据存储 —— SQLite 后端(designs/agui-borrow.md §6)。**按需加载**:
不 require 本 ns 就不碰 JDBC。
**零新依赖**:`next.jdbc` / `sqlite-jdbc` 本来就是 `clj-agent-client` 的依赖
(`im.ttalk.agent.memory.sqlite` 在用),本模块依赖 client,传递可得。
可以与 `memory.sqlite` 共用一个库文件(表名不撞)——于是重启之后侧栏的线程
列表与点进去看到的历史出自同一个文件。
表结构:
agui_threads(id TEXT PK, agent_id TEXT, name TEXT, archived INTEGER,
created_at INTEGER, updated_at INTEGER)
⛔ 只存元数据,不存消息与事件(见 `agui.thread-store` 的 ns docstring)。
```clojure
(require '[im.ttalk.agent.agui.thread-store.sqlite :as ts-sqlite])
(def store (ts-sqlite/sqlite-thread-store "agent.db"))
```(sqlite-thread-store db-path)(sqlite-thread-store db-path {:keys [now]})SQLite 后端的线程存储。db-path 如 "agent.db"(":memory:" 为进程内库)。
持有一个常开连接,用完 (.close store) 或 with-open。
:now (fn [] ms),可注入(测试)SQLite 后端的线程存储。`db-path` 如 `"agent.db"`(`":memory:"` 为进程内库)。 持有一个常开连接,用完 `(.close store)` 或 `with-open`。 - `:now` `(fn [] ms)`,可注入(测试)
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |