mirror of
https://gitea.ingwaz.work/Ingwaz/openbrain-mcp.git
synced 2026-03-31 14:49:06 +00:00
Implement batch_store endpoint for Issue #12
This commit is contained in:
@@ -9,6 +9,8 @@ use tokio_postgres::NoTls;
|
|||||||
use tracing::info;
|
use tracing::info;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use serde::Serialize;
|
||||||
|
use serde_json::Value;
|
||||||
use crate::config::DatabaseConfig;
|
use crate::config::DatabaseConfig;
|
||||||
|
|
||||||
/// Database wrapper with connection pool
|
/// Database wrapper with connection pool
|
||||||
@@ -177,7 +179,7 @@ impl Database {
|
|||||||
|
|
||||||
|
|
||||||
/// Result for a single batch entry
|
/// Result for a single batch entry
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, Serialize)]
|
||||||
pub struct BatchStoreResult {
|
pub struct BatchStoreResult {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub status: String,
|
pub status: String,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
use anyhow::{Context, Result, anyhow};
|
use anyhow::{Context, Result, anyhow};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tracing::{info, warn};
|
use tracing::info;
|
||||||
|
|
||||||
use crate::embedding::extract_keywords;
|
use crate::embedding::extract_keywords;
|
||||||
use crate::AppState;
|
use crate::AppState;
|
||||||
|
|||||||
@@ -188,21 +188,6 @@ async fn sse_handler(
|
|||||||
.event("endpoint")
|
.event("endpoint")
|
||||||
.data(endpoint));
|
.data(endpoint));
|
||||||
|
|
||||||
// Send initial tools list so Agent Zero knows what's available
|
|
||||||
let tools_response = JsonRpcResponse {
|
|
||||||
jsonrpc: "2.0".to_string(),
|
|
||||||
id: serde_json::json!("initial-tools"),
|
|
||||||
result: Some(serde_json::json!({
|
|
||||||
"tools": tools::get_tool_definitions()
|
|
||||||
})),
|
|
||||||
error: None,
|
|
||||||
};
|
|
||||||
|
|
||||||
yield Ok(Event::default()
|
|
||||||
.event("message")
|
|
||||||
.json_data(&tools_response)
|
|
||||||
.unwrap());
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
maybe_message = session_rx.recv() => {
|
maybe_message = session_rx.recv() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user