mirror of
https://github.com/perstarkse/minne.git
synced 2026-04-25 10:18:38 +02:00
wip datetime impl
This commit is contained in:
150
Cargo.lock
generated
150
Cargo.lock
generated
@@ -280,7 +280,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_urlencoded",
|
"serde_urlencoded",
|
||||||
"static_assertions_next",
|
"static_assertions_next",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -297,7 +297,7 @@ dependencies = [
|
|||||||
"quote",
|
"quote",
|
||||||
"strum",
|
"strum",
|
||||||
"syn 2.0.87",
|
"syn 2.0.87",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -343,7 +343,7 @@ dependencies = [
|
|||||||
"secrecy",
|
"secrecy",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
@@ -537,7 +537,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2",
|
"sha2",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tower-layer",
|
"tower-layer",
|
||||||
"tower-service",
|
"tower-service",
|
||||||
@@ -595,7 +595,7 @@ dependencies = [
|
|||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
"uuid",
|
"uuid",
|
||||||
]
|
]
|
||||||
@@ -882,7 +882,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"smol_str",
|
"smol_str",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -905,7 +905,7 @@ dependencies = [
|
|||||||
"serde_with",
|
"serde_with",
|
||||||
"smol_str",
|
"smol_str",
|
||||||
"stacker",
|
"stacker",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -921,7 +921,7 @@ dependencies = [
|
|||||||
"serde_with",
|
"serde_with",
|
||||||
"smol_str",
|
"smol_str",
|
||||||
"stacker",
|
"stacker",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
"unicode-security",
|
"unicode-security",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -939,9 +939,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
version = "0.4.38"
|
version = "0.4.39"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
|
checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android-tzdata",
|
"android-tzdata",
|
||||||
"iana-time-zone",
|
"iana-time-zone",
|
||||||
@@ -1361,39 +1361,6 @@ version = "0.3.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
|
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dom_query"
|
|
||||||
version = "0.11.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7f36ad8fe49e1234652c9e62472a8429c46d03af5e4d230edf499fd352907786"
|
|
||||||
dependencies = [
|
|
||||||
"cssparser",
|
|
||||||
"foldhash",
|
|
||||||
"html5ever 0.29.0",
|
|
||||||
"precomputed-hash",
|
|
||||||
"selectors",
|
|
||||||
"tendril",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dom_smoothie"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "88147dc268d8ede25890504bbbeeb4168d7ea47c1bff921176ddec722660fc1e"
|
|
||||||
dependencies = [
|
|
||||||
"dom_query",
|
|
||||||
"flagset",
|
|
||||||
"gjson",
|
|
||||||
"html-escape",
|
|
||||||
"once_cell",
|
|
||||||
"regex",
|
|
||||||
"serde",
|
|
||||||
"tendril",
|
|
||||||
"thiserror 2.0.10",
|
|
||||||
"unicode-segmentation",
|
|
||||||
"url",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "downcast"
|
name = "downcast"
|
||||||
version = "0.11.0"
|
version = "0.11.0"
|
||||||
@@ -1545,12 +1512,6 @@ version = "0.4.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
|
checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "flagset"
|
|
||||||
version = "0.4.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b3ea1ec5f8307826a5b71094dd91fc04d4ae75d5709b20ad351c7fb4815c86ec"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "float_next_after"
|
name = "float_next_after"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
@@ -1563,12 +1524,6 @@ version = "1.0.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "foldhash"
|
|
||||||
version = "0.1.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "foreign-types"
|
name = "foreign-types"
|
||||||
version = "0.3.2"
|
version = "0.3.2"
|
||||||
@@ -1600,7 +1555,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "8835f84f38484cc86f110a805655697908257fb9a7af005234060891557198e9"
|
checksum = "8835f84f38484cc86f110a805655697908257fb9a7af005234060891557198e9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"nonempty",
|
"nonempty",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1854,12 +1809,6 @@ version = "0.31.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64"
|
checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gjson"
|
|
||||||
version = "0.8.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "43503cc176394dd30a6525f5f36e838339b8b5619be33ed9a7783841580a97b6"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "h2"
|
name = "h2"
|
||||||
version = "0.4.7"
|
version = "0.4.7"
|
||||||
@@ -1986,15 +1935,6 @@ dependencies = [
|
|||||||
"windows",
|
"windows",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "html-escape"
|
|
||||||
version = "0.2.13"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6d1ad449764d627e22bfd7cd5e8868264fc9236e07c752972b4080cd351cb476"
|
|
||||||
dependencies = [
|
|
||||||
"utf8-width",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "html5ever"
|
name = "html5ever"
|
||||||
version = "0.27.0"
|
version = "0.27.0"
|
||||||
@@ -2585,7 +2525,7 @@ dependencies = [
|
|||||||
"ndarray",
|
"ndarray",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"rand",
|
"rand",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2711,7 +2651,7 @@ checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"miette-derive",
|
"miette-derive",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3216,7 +3156,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "fdbef9d1d47087a895abd220ed25eb4ad973a5e26f6a4367b038c25e28dfc2d9"
|
checksum = "fdbef9d1d47087a895abd220ed25eb4ad973a5e26f6a4367b038c25e28dfc2d9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
"ucd-trie",
|
"ucd-trie",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3532,7 +3472,7 @@ dependencies = [
|
|||||||
"rustc-hash 2.0.0",
|
"rustc-hash 2.0.0",
|
||||||
"rustls",
|
"rustls",
|
||||||
"socket2",
|
"socket2",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
@@ -3549,7 +3489,7 @@ dependencies = [
|
|||||||
"rustc-hash 2.0.0",
|
"rustc-hash 2.0.0",
|
||||||
"rustls",
|
"rustls",
|
||||||
"slab",
|
"slab",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
"tinyvec",
|
"tinyvec",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
@@ -3658,7 +3598,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom",
|
"getrandom",
|
||||||
"libredox",
|
"libredox",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3800,7 +3740,7 @@ dependencies = [
|
|||||||
"nom",
|
"nom",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4304,9 +4244,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_with"
|
name = "serde_with"
|
||||||
version = "3.11.0"
|
version = "3.12.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817"
|
checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"chrono",
|
"chrono",
|
||||||
@@ -4322,9 +4262,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_with_macros"
|
name = "serde_with_macros"
|
||||||
version = "3.11.0"
|
version = "3.12.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d"
|
checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"darling",
|
"darling",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@@ -4401,7 +4341,7 @@ checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"num-bigint",
|
"num-bigint",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
"time",
|
"time",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -4525,7 +4465,7 @@ dependencies = [
|
|||||||
"byteorder",
|
"byteorder",
|
||||||
"memchr",
|
"memchr",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4616,7 +4556,7 @@ dependencies = [
|
|||||||
"serde-content",
|
"serde-content",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"surrealdb-core",
|
"surrealdb-core",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-tungstenite",
|
"tokio-tungstenite",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
@@ -4698,7 +4638,7 @@ dependencies = [
|
|||||||
"storekey",
|
"storekey",
|
||||||
"subtle",
|
"subtle",
|
||||||
"surrealdb-derive",
|
"surrealdb-derive",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
"trice",
|
"trice",
|
||||||
@@ -4856,7 +4796,7 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
"regex",
|
"regex",
|
||||||
"strum",
|
"strum",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -4866,16 +4806,7 @@ version = "1.0.69"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl 1.0.69",
|
"thiserror-impl",
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "thiserror"
|
|
||||||
version = "2.0.10"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a3ac7f54ca534db81081ef1c1e7f6ea8a3ef428d2fc069097c079443d24124d3"
|
|
||||||
dependencies = [
|
|
||||||
"thiserror-impl 2.0.10",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4889,17 +4820,6 @@ dependencies = [
|
|||||||
"syn 2.0.87",
|
"syn 2.0.87",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "thiserror-impl"
|
|
||||||
version = "2.0.10"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9e9465d30713b56a37ede7185763c3492a91be2f5fa68d958c44e41ab9248beb"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 2.0.87",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thread_local"
|
name = "thread_local"
|
||||||
version = "1.1.8"
|
version = "1.1.8"
|
||||||
@@ -5270,7 +5190,7 @@ dependencies = [
|
|||||||
"rustls",
|
"rustls",
|
||||||
"rustls-pki-types",
|
"rustls-pki-types",
|
||||||
"sha1",
|
"sha1",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
"url",
|
"url",
|
||||||
"utf-8",
|
"utf-8",
|
||||||
]
|
]
|
||||||
@@ -5409,12 +5329,6 @@ version = "1.0.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246"
|
checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "utf8-width"
|
|
||||||
version = "0.1.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "utf8_iter"
|
name = "utf8_iter"
|
||||||
version = "1.0.4"
|
version = "1.0.4"
|
||||||
@@ -5793,7 +5707,7 @@ dependencies = [
|
|||||||
"pharos",
|
"pharos",
|
||||||
"rustc_version",
|
"rustc_version",
|
||||||
"send_wrapper",
|
"send_wrapper",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"wasm-bindgen-futures",
|
"wasm-bindgen-futures",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
@@ -5925,8 +5839,8 @@ dependencies = [
|
|||||||
"axum_session_auth",
|
"axum_session_auth",
|
||||||
"axum_session_surreal",
|
"axum_session_surreal",
|
||||||
"axum_typed_multipart",
|
"axum_typed_multipart",
|
||||||
|
"chrono",
|
||||||
"config",
|
"config",
|
||||||
"dom_smoothie",
|
|
||||||
"futures",
|
"futures",
|
||||||
"lettre",
|
"lettre",
|
||||||
"mime",
|
"mime",
|
||||||
@@ -5942,7 +5856,7 @@ dependencies = [
|
|||||||
"surrealdb",
|
"surrealdb",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"text-splitter",
|
"text-splitter",
|
||||||
"thiserror 1.0.69",
|
"thiserror",
|
||||||
"tiktoken-rs",
|
"tiktoken-rs",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tower-http",
|
"tower-http",
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ axum_session = "0.14.4"
|
|||||||
axum_session_auth = "0.14.1"
|
axum_session_auth = "0.14.1"
|
||||||
axum_session_surreal = "0.2.1"
|
axum_session_surreal = "0.2.1"
|
||||||
axum_typed_multipart = "0.12.1"
|
axum_typed_multipart = "0.12.1"
|
||||||
|
chrono = { version = "0.4.39", features = ["serde"] }
|
||||||
config = "0.15.4"
|
config = "0.15.4"
|
||||||
dom_smoothie = "0.3.0"
|
|
||||||
futures = "0.3.31"
|
futures = "0.3.31"
|
||||||
lettre = { version = "0.11.11", features = ["rustls-tls"] }
|
lettre = { version = "0.11.11", features = ["rustls-tls"] }
|
||||||
mime = "0.3.17"
|
mime = "0.3.17"
|
||||||
@@ -46,3 +46,4 @@ path = "src/bin/server.rs"
|
|||||||
[[bin]]
|
[[bin]]
|
||||||
name = "worker"
|
name = "worker"
|
||||||
path = "src/bin/worker.rs"
|
path = "src/bin/worker.rs"
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -20,6 +20,7 @@ need_stdout = false
|
|||||||
command = [
|
command = [
|
||||||
"cargo", "clippy",
|
"cargo", "clippy",
|
||||||
"--color", "always",
|
"--color", "always",
|
||||||
|
"-j","4"
|
||||||
]
|
]
|
||||||
need_stdout = false
|
need_stdout = false
|
||||||
|
|
||||||
@@ -88,7 +89,7 @@ background = true
|
|||||||
# Call it as
|
# Call it as
|
||||||
# bacon ex -- my-example
|
# bacon ex -- my-example
|
||||||
[jobs.server]
|
[jobs.server]
|
||||||
command = ["cargo", "run", "--color", "always", "--bin", "server"]
|
command = ["cargo", "run", "--color", "always", "--bin", "server", "-j", "4"]
|
||||||
need_stdout = true
|
need_stdout = true
|
||||||
allow_warnings = true
|
allow_warnings = true
|
||||||
watch = ["src", "Cargo.toml", "Cargo.lock"]
|
watch = ["src", "Cargo.toml", "Cargo.lock"]
|
||||||
@@ -96,7 +97,7 @@ background = true
|
|||||||
on_change_strategy = "kill_then_restart"
|
on_change_strategy = "kill_then_restart"
|
||||||
|
|
||||||
[jobs.worker]
|
[jobs.worker]
|
||||||
command = ["cargo", "run", "--color", "always", "--bin", "worker"]
|
command = ["cargo", "run", "--color", "always", "--bin", "worker", "-j", "4"]
|
||||||
need_stdout = true
|
need_stdout = true
|
||||||
allow_warnings = true
|
allow_warnings = true
|
||||||
watch = ["src", "Cargo.toml", "Cargo.lock"]
|
watch = ["src", "Cargo.toml", "Cargo.lock"]
|
||||||
|
|||||||
@@ -40,7 +40,14 @@ use zettle_db::{
|
|||||||
},
|
},
|
||||||
AppState,
|
AppState,
|
||||||
},
|
},
|
||||||
storage::{db::SurrealDbClient, types::user::User},
|
storage::{
|
||||||
|
db::SurrealDbClient,
|
||||||
|
types::{
|
||||||
|
file_info::FileInfo, job::Job, knowledge_entity::KnowledgeEntity,
|
||||||
|
knowledge_relationship::KnowledgeRelationship, text_chunk::TextChunk,
|
||||||
|
text_content::TextContent, user::User,
|
||||||
|
},
|
||||||
|
},
|
||||||
utils::{config::get_config, mailer::Mailer},
|
utils::{config::get_config, mailer::Mailer},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -90,8 +97,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
job_queue: Arc::new(JobQueue::new(surreal_db_client)),
|
job_queue: Arc::new(JobQueue::new(surreal_db_client)),
|
||||||
};
|
};
|
||||||
|
|
||||||
// setup_auth(&app_state.surreal_db_client).await?;
|
|
||||||
|
|
||||||
let session_config = SessionConfig::default()
|
let session_config = SessionConfig::default()
|
||||||
.with_table_name("test_session_table")
|
.with_table_name("test_session_table")
|
||||||
.with_secure(true);
|
.with_secure(true);
|
||||||
@@ -104,6 +109,26 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
app_state.surreal_db_client.build_indexes().await?;
|
app_state.surreal_db_client.build_indexes().await?;
|
||||||
|
setup_auth(&app_state.surreal_db_client).await?;
|
||||||
|
// app_state.surreal_db_client.drop_table::<FileInfo>().await?;
|
||||||
|
// app_state.surreal_db_client.drop_table::<User>().await?;
|
||||||
|
// app_state.surreal_db_client.drop_table::<Job>().await?;
|
||||||
|
// app_state
|
||||||
|
// .surreal_db_client
|
||||||
|
// .drop_table::<KnowledgeEntity>()
|
||||||
|
// .await?;
|
||||||
|
// app_state
|
||||||
|
// .surreal_db_client
|
||||||
|
// .drop_table::<KnowledgeRelationship>()
|
||||||
|
// .await?;
|
||||||
|
// app_state
|
||||||
|
// .surreal_db_client
|
||||||
|
// .drop_table::<TextContent>()
|
||||||
|
// .await?;
|
||||||
|
// app_state
|
||||||
|
// .surreal_db_client
|
||||||
|
// .drop_table::<TextChunk>()
|
||||||
|
// .await?;
|
||||||
|
|
||||||
// Create Axum router
|
// Create Axum router
|
||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
@@ -177,14 +202,14 @@ fn html_routes(
|
|||||||
.layer(SessionLayer::new(session_store))
|
.layer(SessionLayer::new(session_store))
|
||||||
}
|
}
|
||||||
|
|
||||||
// async fn setup_auth(db: &SurrealDbClient) -> Result<(), Box<dyn std::error::Error>> {
|
async fn setup_auth(db: &SurrealDbClient) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
// db.query(
|
db.query(
|
||||||
// "DEFINE TABLE user SCHEMALESS;
|
"DEFINE TABLE user SCHEMALESS;
|
||||||
// DEFINE INDEX unique_name ON TABLE user FIELDS email UNIQUE;
|
DEFINE INDEX unique_name ON TABLE user FIELDS email UNIQUE;
|
||||||
// DEFINE ACCESS account ON DATABASE TYPE RECORD
|
DEFINE ACCESS account ON DATABASE TYPE RECORD
|
||||||
// SIGNUP ( CREATE user SET email = $email, password = crypto::argon2::generate($password), anonymous = false, user_id = $user_id)
|
SIGNUP ( CREATE user SET email = $email, password = crypto::argon2::generate($password), anonymous = false, user_id = $user_id)
|
||||||
// SIGNIN ( SELECT * FROM user WHERE email = $email AND crypto::argon2::compare(password, $password) );",
|
SIGNIN ( SELECT * FROM user WHERE email = $email AND crypto::argon2::compare(password, $password) );",
|
||||||
// )
|
)
|
||||||
// .await?;
|
.await?;
|
||||||
// Ok(())
|
Ok(())
|
||||||
// }
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
|
use chrono::Utc;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use tokio::task;
|
use tokio::task;
|
||||||
|
|
||||||
@@ -162,8 +163,11 @@ async fn create_single_entity(
|
|||||||
|
|
||||||
let embedding = generate_embedding(openai_client, &embedding_input).await?;
|
let embedding = generate_embedding(openai_client, &embedding_input).await?;
|
||||||
|
|
||||||
|
let now = Utc::now();
|
||||||
Ok(KnowledgeEntity {
|
Ok(KnowledgeEntity {
|
||||||
id: assigned_id,
|
id: assigned_id,
|
||||||
|
created_at: now,
|
||||||
|
updated_at: now,
|
||||||
name: llm_entity.name.to_string(),
|
name: llm_entity.name.to_string(),
|
||||||
description: llm_entity.description.to_string(),
|
description: llm_entity.description.to_string(),
|
||||||
entity_type: KnowledgeEntityType::from(llm_entity.entity_type.to_string()),
|
entity_type: KnowledgeEntityType::from(llm_entity.entity_type.to_string()),
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
use chrono::Utc;
|
||||||
use futures::Stream;
|
use futures::Stream;
|
||||||
use std::{
|
use std::{
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
@@ -33,6 +34,7 @@ impl JobQueue {
|
|||||||
/// Creates a new job and stores it in the database
|
/// Creates a new job and stores it in the database
|
||||||
pub async fn enqueue(&self, content: IngressObject, user_id: String) -> Result<Job, AppError> {
|
pub async fn enqueue(&self, content: IngressObject, user_id: String) -> Result<Job, AppError> {
|
||||||
let job = Job::new(content, user_id).await;
|
let job = Job::new(content, user_id).await;
|
||||||
|
info!("{:?}", job);
|
||||||
store_item(&self.db, job.clone()).await?;
|
store_item(&self.db, job.clone()).await?;
|
||||||
Ok(job)
|
Ok(job)
|
||||||
}
|
}
|
||||||
@@ -46,6 +48,7 @@ impl JobQueue {
|
|||||||
.await?
|
.await?
|
||||||
.take(0)?;
|
.take(0)?;
|
||||||
|
|
||||||
|
info!("{:?}", jobs);
|
||||||
Ok(jobs)
|
Ok(jobs)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,8 +98,11 @@ impl JobQueue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get unfinished jobs, ie newly created and in progress up two times
|
/// Get unfinished jobs, ie newly created and in progress up two times
|
||||||
pub async fn get_unfinished_jobs(&self) -> Result<Vec<Job>, AppError> {
|
// pub async fn get_unfinished_jobs(&self) -> Result<Vec<Job>, AppError> {
|
||||||
let jobs: Vec<Job> = self
|
pub async fn get_unfinished_jobs(&self) -> Result<(), AppError> {
|
||||||
|
info!("Getting unfinished jobs");
|
||||||
|
// let jobs: Vec<Job> = self
|
||||||
|
let jobs = self
|
||||||
.db
|
.db
|
||||||
.query(
|
.query(
|
||||||
"SELECT * FROM type::table($table)
|
"SELECT * FROM type::table($table)
|
||||||
@@ -110,12 +116,14 @@ impl JobQueue {
|
|||||||
)
|
)
|
||||||
.bind(("table", Job::table_name()))
|
.bind(("table", Job::table_name()))
|
||||||
.bind(("max_attempts", MAX_ATTEMPTS))
|
.bind(("max_attempts", MAX_ATTEMPTS))
|
||||||
.await?
|
.await?;
|
||||||
.take(0)?;
|
// .take(0)?;
|
||||||
|
|
||||||
println!("Unfinished jobs found: {}", jobs.len());
|
info!("{:?}", jobs);
|
||||||
|
// println!("Unfinished jobs found: {}", jobs.len());
|
||||||
|
|
||||||
Ok(jobs)
|
Ok(())
|
||||||
|
// Ok(jobs)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method to process a single job
|
// Method to process a single job
|
||||||
@@ -124,12 +132,6 @@ impl JobQueue {
|
|||||||
job: Job,
|
job: Job,
|
||||||
processor: &ContentProcessor,
|
processor: &ContentProcessor,
|
||||||
) -> Result<(), AppError> {
|
) -> Result<(), AppError> {
|
||||||
let now = SystemTime::now()
|
|
||||||
.duration_since(UNIX_EPOCH)
|
|
||||||
.unwrap()
|
|
||||||
.as_millis()
|
|
||||||
.to_string();
|
|
||||||
|
|
||||||
let current_attempts = match job.status {
|
let current_attempts = match job.status {
|
||||||
JobStatus::InProgress { attempts, .. } => attempts + 1,
|
JobStatus::InProgress { attempts, .. } => attempts + 1,
|
||||||
_ => 1,
|
_ => 1,
|
||||||
@@ -140,7 +142,7 @@ impl JobQueue {
|
|||||||
&job.id,
|
&job.id,
|
||||||
JobStatus::InProgress {
|
JobStatus::InProgress {
|
||||||
attempts: current_attempts,
|
attempts: current_attempts,
|
||||||
last_attempt: now.clone(),
|
last_attempt: Utc::now(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use axum::{extract::State, http::StatusCode, response::IntoResponse, Extension};
|
|||||||
use axum_typed_multipart::{FieldData, TryFromMultipart, TypedMultipart};
|
use axum_typed_multipart::{FieldData, TryFromMultipart, TypedMultipart};
|
||||||
use futures::{future::try_join_all, TryFutureExt};
|
use futures::{future::try_join_all, TryFutureExt};
|
||||||
use tempfile::NamedTempFile;
|
use tempfile::NamedTempFile;
|
||||||
use tracing::info;
|
use tracing::{debug, info};
|
||||||
|
|
||||||
#[derive(Debug, TryFromMultipart)]
|
#[derive(Debug, TryFromMultipart)]
|
||||||
pub struct IngressParams {
|
pub struct IngressParams {
|
||||||
@@ -32,6 +32,8 @@ pub async fn ingress_data(
|
|||||||
}))
|
}))
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
debug!("Got file infos");
|
||||||
|
|
||||||
let ingress_objects = create_ingress_objects(
|
let ingress_objects = create_ingress_objects(
|
||||||
IngressInput {
|
IngressInput {
|
||||||
content: input.content,
|
content: input.content,
|
||||||
@@ -41,6 +43,7 @@ pub async fn ingress_data(
|
|||||||
},
|
},
|
||||||
user.id.as_str(),
|
user.id.as_str(),
|
||||||
)?;
|
)?;
|
||||||
|
debug!("Got ingress objects");
|
||||||
|
|
||||||
let futures: Vec<_> = ingress_objects
|
let futures: Vec<_> = ingress_objects
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ pub async fn index_handler(
|
|||||||
false => 0,
|
false => 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// let latest_text_contents = match auth.current_user.is_some() {
|
||||||
|
// true =>
|
||||||
|
// }
|
||||||
|
|
||||||
// let knowledge_entities = User::get_knowledge_entities(
|
// let knowledge_entities = User::get_knowledge_entities(
|
||||||
// &auth.current_user.clone().unwrap().id,
|
// &auth.current_user.clone().unwrap().id,
|
||||||
// &state.surreal_db_client,
|
// &state.surreal_db_client,
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ use axum_session_auth::AuthSession;
|
|||||||
use axum_session_surreal::SessionSurrealPool;
|
use axum_session_surreal::SessionSurrealPool;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use surrealdb::{engine::any::Any, Surreal};
|
use surrealdb::{engine::any::Any, Surreal};
|
||||||
|
use tracing::info;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
error::{AppError, HtmlError},
|
error::{AppError, HtmlError},
|
||||||
@@ -63,7 +64,8 @@ pub async fn process_signup_and_show_verification(
|
|||||||
) -> Result<impl IntoResponse, HtmlError> {
|
) -> Result<impl IntoResponse, HtmlError> {
|
||||||
let user = match User::create_new(form.email, form.password, &state.surreal_db_client).await {
|
let user = match User::create_new(form.email, form.password, &state.surreal_db_client).await {
|
||||||
Ok(user) => user,
|
Ok(user) => user,
|
||||||
Err(_) => {
|
Err(e) => {
|
||||||
|
info!("{:?}", e);
|
||||||
return Ok(Html("<p>User already exists</p>").into_response());
|
return Ok(Html("<p>User already exists</p>").into_response());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -71,9 +71,12 @@ impl FileInfo {
|
|||||||
let uuid = Uuid::new_v4();
|
let uuid = Uuid::new_v4();
|
||||||
let sanitized_file_name = Self::sanitize_file_name(&file_name);
|
let sanitized_file_name = Self::sanitize_file_name(&file_name);
|
||||||
|
|
||||||
|
let now = Utc::now();
|
||||||
// Create new FileInfo instance
|
// Create new FileInfo instance
|
||||||
let file_info = Self {
|
let file_info = Self {
|
||||||
id: uuid.to_string(),
|
id: uuid.to_string(),
|
||||||
|
created_at: now,
|
||||||
|
updated_at: now,
|
||||||
sha256,
|
sha256,
|
||||||
path: Self::persist_file(&uuid, file, &sanitized_file_name, user_id)
|
path: Self::persist_file(&uuid, file, &sanitized_file_name, user_id)
|
||||||
.await?
|
.await?
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::{ingress::types::ingress_object::IngressObject, stored_object};
|
use crate::{ingress::types::ingress_object::IngressObject, stored_object};
|
||||||
@@ -8,7 +7,7 @@ pub enum JobStatus {
|
|||||||
Created,
|
Created,
|
||||||
InProgress {
|
InProgress {
|
||||||
attempts: u32,
|
attempts: u32,
|
||||||
last_attempt: String, // timestamp
|
last_attempt: DateTime<Utc>,
|
||||||
},
|
},
|
||||||
Completed,
|
Completed,
|
||||||
Error(String),
|
Error(String),
|
||||||
@@ -18,24 +17,18 @@ pub enum JobStatus {
|
|||||||
stored_object!(Job, "job", {
|
stored_object!(Job, "job", {
|
||||||
content: IngressObject,
|
content: IngressObject,
|
||||||
status: JobStatus,
|
status: JobStatus,
|
||||||
created_at: String,
|
|
||||||
updated_at: String,
|
|
||||||
user_id: String
|
user_id: String
|
||||||
});
|
});
|
||||||
|
|
||||||
impl Job {
|
impl Job {
|
||||||
pub async fn new(content: IngressObject, user_id: String) -> Self {
|
pub async fn new(content: IngressObject, user_id: String) -> Self {
|
||||||
let now = SystemTime::now()
|
let now = Utc::now();
|
||||||
.duration_since(UNIX_EPOCH)
|
|
||||||
.unwrap()
|
|
||||||
.as_millis()
|
|
||||||
.to_string();
|
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
id: Uuid::new_v4().to_string(),
|
id: Uuid::new_v4().to_string(),
|
||||||
content,
|
content,
|
||||||
status: JobStatus::Created,
|
status: JobStatus::Created,
|
||||||
created_at: now.clone(),
|
created_at: now,
|
||||||
updated_at: now,
|
updated_at: now,
|
||||||
user_id,
|
user_id,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,11 @@ impl KnowledgeEntity {
|
|||||||
embedding: Vec<f32>,
|
embedding: Vec<f32>,
|
||||||
user_id: String,
|
user_id: String,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
let now = Utc::now();
|
||||||
Self {
|
Self {
|
||||||
id: Uuid::new_v4().to_string(),
|
id: Uuid::new_v4().to_string(),
|
||||||
|
created_at: now,
|
||||||
|
updated_at: now,
|
||||||
source_id,
|
source_id,
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
|
|||||||
@@ -18,8 +18,11 @@ impl KnowledgeRelationship {
|
|||||||
relationship_type: String,
|
relationship_type: String,
|
||||||
metadata: Option<serde_json::Value>,
|
metadata: Option<serde_json::Value>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
let now = Utc::now();
|
||||||
Self {
|
Self {
|
||||||
id: Uuid::new_v4().to_string(),
|
id: Uuid::new_v4().to_string(),
|
||||||
|
created_at: now,
|
||||||
|
updated_at: now,
|
||||||
in_,
|
in_,
|
||||||
out,
|
out,
|
||||||
relationship_type,
|
relationship_type,
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ macro_rules! stored_object {
|
|||||||
use $crate::storage::types::StoredObject;
|
use $crate::storage::types::StoredObject;
|
||||||
use serde::de::{self, Visitor};
|
use serde::de::{self, Visitor};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
use chrono::{DateTime, Utc };
|
||||||
|
|
||||||
struct FlexibleIdVisitor;
|
struct FlexibleIdVisitor;
|
||||||
|
|
||||||
@@ -64,10 +65,61 @@ macro_rules! stored_object {
|
|||||||
deserializer.deserialize_any(FlexibleIdVisitor)
|
deserializer.deserialize_any(FlexibleIdVisitor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn serialize_datetime<S>(date: &DateTime<Utc>, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
|
where
|
||||||
|
S: serde::Serializer,
|
||||||
|
{
|
||||||
|
Into::<surrealdb::sql::Datetime>::into(*date).serialize(serializer)
|
||||||
|
}
|
||||||
|
|
||||||
|
// fn deserialize_datetime<'de, D>(deserializer: D) -> Result<DateTime<Utc>, D::Error>
|
||||||
|
// where
|
||||||
|
// D: serde::Deserializer<'de>,
|
||||||
|
// {
|
||||||
|
// let dt = surrealdb::sql::Datetime::deserialize(deserializer)?;
|
||||||
|
// Ok(DateTime::<Utc>::from(dt))
|
||||||
|
// }
|
||||||
|
fn deserialize_datetime<'de, D>(deserializer: D) -> Result<DateTime<Utc>, D::Error>
|
||||||
|
where
|
||||||
|
D: serde::Deserializer<'de>,
|
||||||
|
{
|
||||||
|
use serde::de::Error;
|
||||||
|
|
||||||
|
// Accept various formats
|
||||||
|
let value = serde_json::Value::deserialize(deserializer)?;
|
||||||
|
|
||||||
|
match value {
|
||||||
|
// Handle string format
|
||||||
|
serde_json::Value::String(s) => {
|
||||||
|
if s.starts_with("d\"") && s.ends_with('\"') {
|
||||||
|
let cleaned = &s[2..s.len()-1];
|
||||||
|
DateTime::parse_from_rfc3339(cleaned)
|
||||||
|
.map(|dt| dt.with_timezone(&Utc))
|
||||||
|
.map_err(Error::custom)
|
||||||
|
} else {
|
||||||
|
DateTime::parse_from_rfc3339(&s)
|
||||||
|
.map(|dt| dt.with_timezone(&Utc))
|
||||||
|
.map_err(Error::custom)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Handle object format (in case SurrealDB returns datetime as an object)
|
||||||
|
serde_json::Value::Object(_) => {
|
||||||
|
let dt = surrealdb::sql::Datetime::deserialize(value)
|
||||||
|
.map_err(Error::custom)?;
|
||||||
|
Ok(DateTime::<Utc>::from(dt))
|
||||||
|
},
|
||||||
|
_ => Err(Error::custom("unexpected datetime format")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct $name {
|
pub struct $name {
|
||||||
#[serde(deserialize_with = "deserialize_flexible_id")]
|
#[serde(deserialize_with = "deserialize_flexible_id")]
|
||||||
pub id: String,
|
pub id: String,
|
||||||
|
#[serde(serialize_with = "serialize_datetime", deserialize_with = "deserialize_datetime", default)]
|
||||||
|
pub created_at: DateTime<Utc>,
|
||||||
|
#[serde(serialize_with = "serialize_datetime", deserialize_with = "deserialize_datetime", default)]
|
||||||
|
pub updated_at: DateTime<Utc>,
|
||||||
$(pub $field: $ty),*
|
$(pub $field: $ty),*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,11 @@ stored_object!(TextChunk, "text_chunk", {
|
|||||||
|
|
||||||
impl TextChunk {
|
impl TextChunk {
|
||||||
pub fn new(source_id: String, chunk: String, embedding: Vec<f32>, user_id: String) -> Self {
|
pub fn new(source_id: String, chunk: String, embedding: Vec<f32>, user_id: String) -> Self {
|
||||||
|
let now = Utc::now();
|
||||||
Self {
|
Self {
|
||||||
id: Uuid::new_v4().to_string(),
|
id: Uuid::new_v4().to_string(),
|
||||||
|
created_at: now,
|
||||||
|
updated_at: now,
|
||||||
source_id,
|
source_id,
|
||||||
chunk,
|
chunk,
|
||||||
embedding,
|
embedding,
|
||||||
|
|||||||
@@ -20,8 +20,11 @@ impl TextContent {
|
|||||||
file_info: Option<FileInfo>,
|
file_info: Option<FileInfo>,
|
||||||
user_id: String,
|
user_id: String,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
let now = Utc::now();
|
||||||
Self {
|
Self {
|
||||||
id: Uuid::new_v4().to_string(),
|
id: Uuid::new_v4().to_string(),
|
||||||
|
created_at: now,
|
||||||
|
updated_at: now,
|
||||||
text,
|
text,
|
||||||
file_info,
|
file_info,
|
||||||
instructions,
|
instructions,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use axum_session_auth::Authentication;
|
|||||||
use surrealdb::{engine::any::Any, Surreal};
|
use surrealdb::{engine::any::Any, Surreal};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use super::knowledge_entity::KnowledgeEntity;
|
use super::{knowledge_entity::KnowledgeEntity, text_content::TextContent};
|
||||||
|
|
||||||
stored_object!(User, "user", {
|
stored_object!(User, "user", {
|
||||||
email: String,
|
email: String,
|
||||||
@@ -47,6 +47,8 @@ impl User {
|
|||||||
return Err(AppError::Auth("User already exists".into()));
|
return Err(AppError::Auth("User already exists".into()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let now = Utc::now();
|
||||||
|
|
||||||
let id = Uuid::new_v4().to_string();
|
let id = Uuid::new_v4().to_string();
|
||||||
let user: Option<User> = db
|
let user: Option<User> = db
|
||||||
.client
|
.client
|
||||||
@@ -54,11 +56,15 @@ impl User {
|
|||||||
"CREATE type::thing('user', $id) SET
|
"CREATE type::thing('user', $id) SET
|
||||||
email = $email,
|
email = $email,
|
||||||
password = crypto::argon2::generate($password),
|
password = crypto::argon2::generate($password),
|
||||||
anonymous = false",
|
anonymous = false,
|
||||||
|
created_at = $created_at,
|
||||||
|
updated_at = $updated_at",
|
||||||
)
|
)
|
||||||
.bind(("id", id))
|
.bind(("id", id))
|
||||||
.bind(("email", email))
|
.bind(("email", email))
|
||||||
.bind(("password", password))
|
.bind(("password", password))
|
||||||
|
.bind(("created_at", now))
|
||||||
|
.bind(("updated_at", now))
|
||||||
.await?
|
.await?
|
||||||
.take(0)?;
|
.take(0)?;
|
||||||
|
|
||||||
@@ -169,4 +175,18 @@ impl User {
|
|||||||
|
|
||||||
Ok(entities)
|
Ok(entities)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn get_latest_text_contents(
|
||||||
|
id: &str,
|
||||||
|
db: &SurrealDbClient,
|
||||||
|
) -> Result<Vec<TextContent>, AppError> {
|
||||||
|
let items: Vec<TextContent> = db
|
||||||
|
.client
|
||||||
|
.query("SELECT * FROM text_content WHERE user_id = $user_id ORDER BY created_at DESC LIMIT 5")
|
||||||
|
.bind(("user_id", id.to_owned()))
|
||||||
|
.await?
|
||||||
|
.take(0)?;
|
||||||
|
|
||||||
|
Ok(items)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
todo.md
1
todo.md
@@ -5,6 +5,7 @@
|
|||||||
\[x\] hx-redirect
|
\[x\] hx-redirect
|
||||||
\[x\] macro for pagedata?
|
\[x\] macro for pagedata?
|
||||||
\[\] add more config structs for clarity
|
\[\] add more config structs for clarity
|
||||||
|
\[\] configs primarily get envs
|
||||||
\[x\] user id to fileinfo and data path?
|
\[x\] user id to fileinfo and data path?
|
||||||
\[x\] gdpr
|
\[x\] gdpr
|
||||||
\[x\] ios shortcut generation
|
\[x\] ios shortcut generation
|
||||||
|
|||||||
Reference in New Issue
Block a user