feat(hololake): bind direct-language V1 baseline
This commit is contained in:
parent
e88805cf91
commit
3df6b1d3ca
14 changed files with 809 additions and 23 deletions
|
|
@ -1330,6 +1330,7 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
|||
name = "hololake-clean-desktop"
|
||||
version = "1.1.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ serde_json = "1"
|
|||
sha2 = "0.10"
|
||||
uuid = { version = "1", features = ["v4"] }
|
||||
regex = "1"
|
||||
chrono = { version = "0.4", default-features = false, features = ["clock"] }
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use crate::model::{
|
||||
Channel, ExternalAiBridge, KnowledgeDocument, KnowledgeSummary, SourceKind, TimelineEvent,
|
||||
};
|
||||
use chrono::{DateTime, SecondsFormat, Utc};
|
||||
use sha2::{Digest, Sha256};
|
||||
use std::{
|
||||
fs,
|
||||
|
|
@ -11,10 +12,7 @@ use std::{
|
|||
use tauri::{AppHandle, Manager};
|
||||
|
||||
pub fn now() -> String {
|
||||
SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.map(|d| format!("{}.{:03}Z", d.as_secs(), d.subsec_millis()))
|
||||
.unwrap_or_else(|_| "0Z".into())
|
||||
Utc::now().to_rfc3339_opts(SecondsFormat::Millis, true)
|
||||
}
|
||||
pub fn now_unix_ms() -> u128 {
|
||||
SystemTime::now()
|
||||
|
|
@ -214,9 +212,8 @@ fn collect(root: &Path, p: &Path, out: &mut Vec<KnowledgeSummary>) -> Result<(),
|
|||
.map_err(|e| e.to_string())?
|
||||
.modified()
|
||||
.ok()
|
||||
.and_then(|t| t.duration_since(UNIX_EPOCH).ok())
|
||||
.map(|d| d.as_secs().to_string())
|
||||
.unwrap_or_else(|| "0".into());
|
||||
.map(|t| DateTime::<Utc>::from(t).to_rfc3339_opts(SecondsFormat::Millis, true))
|
||||
.unwrap_or_else(|| "1970-01-01T00:00:00.000Z".into());
|
||||
out.push(KnowledgeSummary {
|
||||
path: rel,
|
||||
title,
|
||||
|
|
@ -256,3 +253,15 @@ pub fn bridges(app: &AppHandle) -> Result<Vec<ExternalAiBridge>, String> {
|
|||
pub fn save_bridges(app: &AppHandle, v: &[ExternalAiBridge]) -> Result<(), String> {
|
||||
write_json(&root(app)?.join("external-ai-bridges.json"), &v)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn runtime_timestamps_are_rfc3339_utc() {
|
||||
let value = now();
|
||||
assert!(value.ends_with('Z'));
|
||||
assert!(DateTime::parse_from_rfc3339(&value).is_ok());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue