44 lines
1.5 KiB
Rust
44 lines
1.5 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
/// Frontend-facing URLs for developer tool services.
|
|
///
|
|
/// Provided as a context signal in `AppShell` so that developer pages
|
|
/// can read the configured URLs without threading props through layouts.
|
|
/// An empty string indicates the service is not configured.
|
|
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
|
|
pub struct ServiceUrlsContext {
|
|
/// LangGraph agent builder URL (empty if not configured)
|
|
pub langgraph_url: String,
|
|
/// LangFlow visual workflow builder URL (empty if not configured)
|
|
pub langflow_url: String,
|
|
/// Langfuse observability URL (empty if not configured)
|
|
pub langfuse_url: String,
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
#[test]
|
|
fn default_urls_are_empty() {
|
|
let ctx = ServiceUrlsContext::default();
|
|
assert_eq!(ctx.langgraph_url, "");
|
|
assert_eq!(ctx.langflow_url, "");
|
|
assert_eq!(ctx.langfuse_url, "");
|
|
}
|
|
|
|
#[test]
|
|
fn serde_round_trip() {
|
|
let ctx = ServiceUrlsContext {
|
|
langgraph_url: "http://localhost:8123".into(),
|
|
langflow_url: "http://localhost:7860".into(),
|
|
langfuse_url: "http://localhost:3000".into(),
|
|
};
|
|
let json = serde_json::to_string(&ctx).expect("serialize ServiceUrlsContext");
|
|
let back: ServiceUrlsContext =
|
|
serde_json::from_str(&json).expect("deserialize ServiceUrlsContext");
|
|
assert_eq!(ctx, back);
|
|
}
|
|
}
|