mirror of
https://github.com/perstarkse/minne.git
synced 2026-04-21 00:11:26 +02:00
refactor: separation of json-stream-parser to own crate
This commit is contained in:
8
Cargo.lock
generated
8
Cargo.lock
generated
@@ -2076,6 +2076,7 @@ dependencies = [
|
|||||||
"composite-retrieval",
|
"composite-retrieval",
|
||||||
"futures",
|
"futures",
|
||||||
"include_dir",
|
"include_dir",
|
||||||
|
"json-stream-parser",
|
||||||
"minijinja",
|
"minijinja",
|
||||||
"minijinja-autoreload",
|
"minijinja-autoreload",
|
||||||
"minijinja-contrib",
|
"minijinja-contrib",
|
||||||
@@ -2601,6 +2602,13 @@ dependencies = [
|
|||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "json-stream-parser"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"serde_json",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "json5"
|
name = "json5"
|
||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ members = [
|
|||||||
"html-router",
|
"html-router",
|
||||||
"ingestion-pipeline",
|
"ingestion-pipeline",
|
||||||
"composite-retrieval"
|
"composite-retrieval"
|
||||||
]
|
, "json-stream-parser"]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
pub mod config;
|
pub mod config;
|
||||||
pub mod embedding;
|
pub mod embedding;
|
||||||
pub mod stream_parser;
|
|
||||||
pub mod template_engine;
|
pub mod template_engine;
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ include_dir = "0.7.4"
|
|||||||
|
|
||||||
common = { path = "../common" }
|
common = { path = "../common" }
|
||||||
composite-retrieval = { path = "../composite-retrieval" }
|
composite-retrieval = { path = "../composite-retrieval" }
|
||||||
|
json-stream-parser = { path = "../json-stream-parser" }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
minijinja-embed = { version = "2.8.0" }
|
minijinja-embed = { version = "2.8.0" }
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ use futures::{
|
|||||||
stream::{self, once},
|
stream::{self, once},
|
||||||
Stream, StreamExt, TryStreamExt,
|
Stream, StreamExt, TryStreamExt,
|
||||||
};
|
};
|
||||||
|
use json_stream_parser::JsonStreamParser;
|
||||||
use minijinja::Value;
|
use minijinja::Value;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::from_str;
|
use serde_json::from_str;
|
||||||
@@ -28,17 +29,14 @@ use surrealdb::{engine::any::Any, Surreal};
|
|||||||
use tokio::sync::{mpsc::channel, Mutex};
|
use tokio::sync::{mpsc::channel, Mutex};
|
||||||
use tracing::{debug, error};
|
use tracing::{debug, error};
|
||||||
|
|
||||||
use common::{
|
use common::storage::{
|
||||||
storage::{
|
db::SurrealDbClient,
|
||||||
db::SurrealDbClient,
|
types::{
|
||||||
types::{
|
conversation::Conversation,
|
||||||
conversation::Conversation,
|
message::{Message, MessageRole},
|
||||||
message::{Message, MessageRole},
|
system_settings::SystemSettings,
|
||||||
system_settings::SystemSettings,
|
user::User,
|
||||||
user::User,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
utils::stream_parser::JsonStreamParser,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::html_state::HtmlState;
|
use crate::html_state::HtmlState;
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ fn get_plot_html(
|
|||||||
Ok(plot.to_html())
|
Ok(plot.to_html())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Small utility to unzip tuple3 vectors from iterators (add this helper)
|
// Small utility to unzip tuple3 vectors from iterators
|
||||||
trait Unzip3<A, B, C> {
|
trait Unzip3<A, B, C> {
|
||||||
fn unzip3(self) -> (Vec<A>, Vec<B>, Vec<C>);
|
fn unzip3(self) -> (Vec<A>, Vec<B>, Vec<C>);
|
||||||
}
|
}
|
||||||
|
|||||||
7
json-stream-parser/Cargo.toml
Normal file
7
json-stream-parser/Cargo.toml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "json-stream-parser"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
serde_json = { workspace = true }
|
||||||
Reference in New Issue
Block a user