use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use std::time::Duration;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct ChatConfig {
pub max_context_length: usize,
pub temperature: f32,
pub max_retrieval_results: usize,
pub enable_sparql_generation: bool,
pub session_timeout: Duration,
pub max_conversation_turns: usize,
pub enable_context_summarization: bool,
pub sliding_window_size: usize,
}
impl Default for ChatConfig {
fn default() -> Self {
Self {
max_context_length: 4096,
temperature: 0.7,
max_retrieval_results: 10,
enable_sparql_generation: true,
session_timeout: Duration::from_secs(3600),
max_conversation_turns: 100,
enable_context_summarization: true,
sliding_window_size: 20,
}
}
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct Message {
pub id: String,
pub role: MessageRole,
pub content: MessageContent,
pub timestamp: chrono::DateTime<chrono::Utc>,
pub metadata: Option<MessageMetadata>,
pub thread_id: Option<String>,
pub parent_message_id: Option<String>,
pub token_count: Option<usize>,
pub reactions: Vec<MessageReaction>,
pub attachments: Vec<MessageAttachment>,
pub rich_elements: Vec<RichContentElement>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum MessageContent {
Text(String),
Rich {
text: String,
elements: Vec<RichContentElement>,
},
}
impl MessageContent {
pub fn to_text(&self) -> &str {
match self {
MessageContent::Text(text) => text,
MessageContent::Rich { text, .. } => text,
}
}
pub fn from_text(text: String) -> Self {
MessageContent::Text(text)
}
pub fn add_element(&mut self, element: RichContentElement) {
match self {
MessageContent::Text(text) => {
let text = std::mem::take(text);
*self = MessageContent::Rich {
text,
elements: vec![element],
};
}
MessageContent::Rich { elements, .. } => {
elements.push(element);
}
}
}
pub fn len(&self) -> usize {
self.to_text().len()
}
pub fn contains(&self, pat: char) -> bool {
self.to_text().contains(pat)
}
pub fn to_lowercase(&self) -> String {
self.to_text().to_lowercase()
}
pub fn chars(&self) -> std::str::Chars<'_> {
self.to_text().chars()
}
pub fn is_empty(&self) -> bool {
self.to_text().is_empty()
}
}
impl std::fmt::Display for MessageContent {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.to_text())
}
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum MessageRole {
User,
Assistant,
System,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MessageMetadata {
pub session_id: String,
pub turn_number: usize,
pub processing_time_ms: Option<u64>,
pub retrieval_results: Option<usize>,
pub sparql_query: Option<String>,
pub confidence_score: Option<f32>,
pub intent: Option<String>,
pub entities: Vec<String>,
pub topics: Vec<String>,
pub quality_score: Option<f32>,
pub user_feedback: Option<UserFeedback>,
pub error_details: Option<ErrorDetails>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UserFeedback {
pub rating: u8, pub helpful: Option<bool>,
pub comment: Option<String>,
pub timestamp: chrono::DateTime<chrono::Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ErrorDetails {
pub error_type: String,
pub error_message: String,
pub error_code: Option<String>,
pub stack_trace: Option<String>,
pub recovery_suggestions: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MessageReaction {
pub reaction_type: ReactionType,
pub user_id: Option<String>,
pub timestamp: chrono::DateTime<chrono::Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ReactionType {
Like,
Dislike,
Helpful,
NotHelpful,
Accurate,
Inaccurate,
Clear,
Confusing,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MessageAttachment {
pub id: String,
pub filename: String,
pub file_type: String,
pub size_bytes: u64,
pub url: Option<String>,
pub thumbnail_url: Option<String>,
pub metadata: AttachmentMetadata,
pub upload_timestamp: chrono::DateTime<chrono::Utc>,
pub processing_status: AttachmentProcessingStatus,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AttachmentMetadata {
pub extracted_text: Option<String>,
pub language: Option<String>,
pub format_detected: Option<String>,
pub processing_notes: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum AttachmentProcessingStatus {
Pending,
Processing,
Completed,
Failed(String),
PartiallyProcessed(String),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum RichContentElement {
CodeBlock {
language: String,
code: String,
title: Option<String>,
line_numbers: bool,
highlight_lines: Vec<usize>,
},
SparqlQuery {
query: String,
execution_time_ms: Option<u64>,
result_count: Option<usize>,
status: QueryExecutionStatus,
explanation: Option<String>,
},
Table {
headers: Vec<String>,
rows: Vec<Vec<String>>,
title: Option<String>,
pagination: Option<TablePagination>,
sorting: Option<TableSorting>,
formatting: TableFormatting,
},
GraphVisualization {
graph_type: GraphType,
data: GraphData,
layout: GraphLayout,
styling: GraphStyling,
interactive: bool,
},
Chart {
chart_type: ChartType,
data: ChartData,
title: Option<String>,
axes: ChartAxes,
styling: ChartStyling,
},
FileReference {
file_id: String,
filename: String,
file_type: String,
size_bytes: u64,
preview: Option<FilePreview>,
},
Widget {
widget_type: WidgetType,
data: serde_json::Value,
config: WidgetConfig,
},
Timeline {
events: Vec<TimelineEvent>,
range: TimelineRange,
styling: TimelineStyling,
},
QuantumVisualization {
results: Vec<QuantumSearchResult>,
entanglement_map: std::collections::HashMap<String, f32>,
},
ConsciousnessInsights {
insights: Vec<ConsciousnessInsight>,
awareness_level: f32,
},
ReasoningChain {
reasoning_steps: Vec<ReasoningStep>,
confidence_score: f32,
},
SPARQLResults {
query: String,
results: Vec<std::collections::HashMap<String, String>>,
execution_time: Duration,
},
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum QueryExecutionStatus {
Success,
Error(String),
Timeout,
Cancelled,
ValidationError(String),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TablePagination {
pub current_page: usize,
pub total_pages: usize,
pub page_size: usize,
pub total_rows: usize,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TableSorting {
pub column: String,
pub direction: SortDirection,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum SortDirection {
Ascending,
Descending,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TableFormatting {
pub striped_rows: bool,
pub borders: bool,
pub compact: bool,
pub theme: TableTheme,
pub cell_padding: CellPadding,
pub column_widths: Vec<ColumnWidth>,
}
impl Default for TableFormatting {
fn default() -> Self {
Self {
striped_rows: true,
borders: true,
compact: false,
theme: TableTheme::Default,
cell_padding: CellPadding::Medium,
column_widths: vec![],
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum TableTheme {
Default,
Dark,
Light,
Minimal,
Professional,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum CellPadding {
None,
Small,
Medium,
Large,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ColumnWidth {
Auto,
Fixed(u32),
Percentage(f32),
MinMax { min: u32, max: u32 },
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum GraphType {
Network,
Tree,
Hierarchy,
Flow,
Timeline,
Circular,
Force,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GraphData {
pub nodes: Vec<GraphNode>,
pub edges: Vec<GraphEdge>,
pub metadata: GraphMetadata,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GraphNode {
pub id: String,
pub label: String,
pub node_type: String,
pub properties: std::collections::HashMap<String, serde_json::Value>,
pub styling: NodeStyling,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GraphEdge {
pub id: String,
pub source: String,
pub target: String,
pub label: Option<String>,
pub edge_type: String,
pub weight: Option<f64>,
pub properties: std::collections::HashMap<String, serde_json::Value>,
pub styling: EdgeStyling,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GraphMetadata {
pub title: Option<String>,
pub description: Option<String>,
pub source: Option<String>,
pub node_count: usize,
pub edge_count: usize,
pub creation_time: chrono::DateTime<chrono::Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GraphLayout {
pub algorithm: LayoutAlgorithm,
pub parameters: std::collections::HashMap<String, serde_json::Value>,
pub constraints: Vec<LayoutConstraint>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum LayoutAlgorithm {
ForceDirected,
Hierarchical,
Circular,
Grid,
Random,
Manual,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LayoutConstraint {
pub constraint_type: ConstraintType,
pub target: String,
pub parameters: std::collections::HashMap<String, serde_json::Value>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ConstraintType {
FixedPosition,
MinDistance,
MaxDistance,
Alignment,
Grouping,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GraphStyling {
pub theme: GraphTheme,
pub colors: ColorScheme,
pub fonts: FontConfiguration,
pub effects: VisualEffects,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum GraphTheme {
Light,
Dark,
HighContrast,
Minimal,
Professional,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ColorScheme {
pub primary: String,
pub secondary: String,
pub accent: String,
pub background: String,
pub text: String,
pub edge: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FontConfiguration {
pub family: String,
pub size: u32,
pub weight: FontWeight,
pub style: FontStyle,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum FontWeight {
Normal,
Bold,
Light,
ExtraBold,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum FontStyle {
Normal,
Italic,
Oblique,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VisualEffects {
pub shadows: bool,
pub animations: bool,
pub hover_effects: bool,
pub selection_highlight: bool,
pub zoom_effects: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NodeStyling {
pub shape: NodeShape,
pub size: NodeSize,
pub color: String,
pub border: BorderStyle,
pub icon: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum NodeShape {
Circle,
Square,
Triangle,
Diamond,
Hexagon,
Star,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum NodeSize {
Small,
Medium,
Large,
Custom(u32),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BorderStyle {
pub width: u32,
pub color: String,
pub style: LineStyle,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum LineStyle {
Solid,
Dashed,
Dotted,
Double,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EdgeStyling {
pub line_style: LineStyle,
pub color: String,
pub width: u32,
pub arrow: ArrowStyle,
pub curvature: Curvature,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ArrowStyle {
None,
Simple,
Filled,
Open,
Diamond,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum Curvature {
Straight,
Curved(f32),
Bezier { cp1: (f32, f32), cp2: (f32, f32) },
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ChartType {
Line,
Bar,
Pie,
Scatter,
Area,
Histogram,
Box,
Violin,
Heatmap,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ChartData {
pub series: Vec<DataSeries>,
pub categories: Vec<String>,
pub metadata: ChartMetadata,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DataSeries {
pub name: String,
pub data: Vec<DataPoint>,
pub color: Option<String>,
pub line_style: Option<LineStyle>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DataPoint {
pub x: serde_json::Value,
pub y: serde_json::Value,
pub label: Option<String>,
pub metadata: Option<std::collections::HashMap<String, serde_json::Value>>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ChartMetadata {
pub source: Option<String>,
pub description: Option<String>,
pub units: Option<String>,
pub creation_time: chrono::DateTime<chrono::Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ChartAxes {
pub x_axis: AxisConfiguration,
pub y_axis: AxisConfiguration,
pub secondary_y: Option<AxisConfiguration>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AxisConfiguration {
pub title: Option<String>,
pub scale: AxisScale,
pub range: Option<AxisRange>,
pub tick_format: Option<String>,
pub grid_lines: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum AxisScale {
Linear,
Logarithmic,
Time,
Category,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AxisRange {
pub min: serde_json::Value,
pub max: serde_json::Value,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ChartStyling {
pub theme: ChartTheme,
pub colors: Vec<String>,
pub fonts: FontConfiguration,
pub legend: LegendConfiguration,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ChartTheme {
Default,
Dark,
Light,
Minimal,
Professional,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LegendConfiguration {
pub position: LegendPosition,
pub visible: bool,
pub orientation: LegendOrientation,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum LegendPosition {
Top,
Bottom,
Left,
Right,
TopLeft,
TopRight,
BottomLeft,
BottomRight,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum LegendOrientation {
Horizontal,
Vertical,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FilePreview {
pub preview_type: PreviewType,
pub content: String,
pub thumbnail_url: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum PreviewType {
Text,
Image,
Video,
Audio,
Document,
Code,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum WidgetType {
Slider,
Button,
Input,
Dropdown,
Toggle,
DatePicker,
ColorPicker,
Progress,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WidgetConfig {
pub interactive: bool,
pub validation: Option<ValidationRules>,
pub events: Vec<WidgetEvent>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ValidationRules {
pub required: bool,
pub min_value: Option<serde_json::Value>,
pub max_value: Option<serde_json::Value>,
pub pattern: Option<String>,
pub custom_validator: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WidgetEvent {
pub event_type: String,
pub handler: String,
pub parameters: std::collections::HashMap<String, serde_json::Value>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TimelineEvent {
pub id: String,
pub title: String,
pub description: Option<String>,
pub timestamp: chrono::DateTime<chrono::Utc>,
pub duration: Option<Duration>,
pub event_type: String,
pub metadata: std::collections::HashMap<String, serde_json::Value>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TimelineRange {
pub start: chrono::DateTime<chrono::Utc>,
pub end: chrono::DateTime<chrono::Utc>,
pub scale: TimelineScale,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum TimelineScale {
Minutes,
Hours,
Days,
Weeks,
Months,
Years,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TimelineStyling {
pub theme: TimelineTheme,
pub orientation: TimelineOrientation,
pub marker_style: MarkerStyle,
pub line_style: LineStyle,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum TimelineTheme {
Default,
Minimal,
Detailed,
Compact,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum TimelineOrientation {
Horizontal,
Vertical,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MarkerStyle {
pub shape: MarkerShape,
pub size: u32,
pub color: String,
pub border: BorderStyle,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum MarkerShape {
Circle,
Square,
Triangle,
Diamond,
Star,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum StreamResponseChunk {
Status {
stage: ProcessingStage,
progress: f32, message: Option<String>,
},
Context {
facts: Vec<String>,
sparql_results: Option<std::collections::HashMap<String, String>>,
entities: Vec<String>,
},
Content { text: String, is_complete: bool },
Error {
error: StructuredError,
recoverable: bool,
},
Complete {
total_time: Duration,
token_count: usize,
final_message: Option<String>,
},
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ProcessingStage {
Initializing,
RetrievingContext,
GeneratingSparql,
ExecutingQuery,
QuantumProcessing,
ConsciousnessProcessing,
AdvancedReasoning,
GeneratingResponse,
Finalizing,
}
impl ProcessingStage {
pub fn display_name(&self) -> &'static str {
match self {
ProcessingStage::Initializing => "Initializing",
ProcessingStage::RetrievingContext => "Retrieving Context",
ProcessingStage::GeneratingSparql => "Generating SPARQL",
ProcessingStage::ExecutingQuery => "Executing Query",
ProcessingStage::QuantumProcessing => "Quantum Processing",
ProcessingStage::ConsciousnessProcessing => "Consciousness Processing",
ProcessingStage::AdvancedReasoning => "Advanced Reasoning",
ProcessingStage::GeneratingResponse => "Generating Response",
ProcessingStage::Finalizing => "Finalizing",
}
}
pub fn expected_progress(&self) -> f32 {
match self {
ProcessingStage::Initializing => 0.0,
ProcessingStage::RetrievingContext => 0.1,
ProcessingStage::GeneratingSparql => 0.3,
ProcessingStage::ExecutingQuery => 0.5,
ProcessingStage::QuantumProcessing => 0.6,
ProcessingStage::ConsciousnessProcessing => 0.7,
ProcessingStage::AdvancedReasoning => 0.8,
ProcessingStage::GeneratingResponse => 0.9,
ProcessingStage::Finalizing => 1.0,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct QuantumSearchResult {
pub triple: String,
pub score: f32,
pub quantum_amplitude: f32,
pub phase: f32,
pub entanglement_factor: f32,
pub coherence_time: f32,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConsciousnessInsight {
pub content: String,
pub confidence: f32,
pub insight_type: ConsciousnessInsightType,
pub timestamp: chrono::DateTime<chrono::Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ConsciousnessInsightType {
MemoryTrace,
EmotionalResonance,
AttentionFocus,
MetacognitiveLearning,
TemporalCoherence,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ReasoningStep {
pub reasoning_type: ReasoningType,
pub premise_triples: Vec<String>,
pub conclusion_triple: Option<String>,
pub confidence: f32,
pub explanation: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ReasoningType {
Deductive,
Inductive,
Causal,
Temporal,
Analogical,
Probabilistic,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum EnhancedStreamResponseChunk {
Status {
stage: ProcessingStage,
progress: f32,
stage_details: String,
estimated_remaining_ms: Option<u64>,
},
Context {
content: String,
context_type: ContextType,
confidence: f32,
},
Content {
content: String,
is_final: bool,
content_type: ContentType,
word_count: usize,
},
Error {
error: StructuredError,
recovery_suggestions: Vec<String>,
can_retry: bool,
},
Complete {
message: Box<crate::Message>,
total_time: Duration,
performance_metrics: ProcessingMetrics,
},
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ContextType {
KnowledgeGraphFacts,
EntityExtraction,
SparqlGeneration,
SparqlExecution,
QuantumEnhancement,
ConsciousnessInsights,
ReasoningAnalysis,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ContentType {
PlainText,
FormattedText,
RichContent,
CodeBlock,
Table,
Visualization,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct StructuredError {
pub error_type: ErrorType,
pub message: String,
pub error_code: Option<String>,
pub component: String,
pub timestamp: chrono::DateTime<chrono::Utc>,
pub context: std::collections::HashMap<String, serde_json::Value>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ErrorType {
RagRetrievalError,
SparqlGenerationError,
SparqlExecutionError,
LlmGenerationError,
QuantumProcessingError,
ConsciousnessProcessingError,
ReasoningError,
NetworkError,
TimeoutError,
ValidationError,
InternalError,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProcessingMetrics {
pub total_time_ms: u64,
pub rag_retrieval_time_ms: u64,
pub sparql_generation_time_ms: u64,
pub sparql_execution_time_ms: u64,
pub llm_generation_time_ms: u64,
pub quantum_processing_time_ms: u64,
pub consciousness_processing_time_ms: u64,
pub reasoning_time_ms: u64,
pub memory_usage_mb: f32,
pub cpu_usage_percent: f32,
pub cache_hit_rate: f32,
pub token_count: usize,
pub request_size_bytes: usize,
pub response_size_bytes: usize,
}
#[derive(Debug, Default, Clone)]
pub struct ConversationAnalysis {
pub question_count: usize,
pub resolved_questions: usize,
pub unresolved_questions: usize,
pub assistant_response_count: usize,
pub error_mentions: usize,
pub code_examples: usize,
}
#[derive(Debug, Clone)]
pub struct KeyConcept {
pub name: String,
pub frequency: usize,
pub importance: f32,
pub context: String,
}
#[derive(Debug, Clone)]
pub struct KeyOutcome {
pub description: String,
pub message_id: String,
pub outcome_type: OutcomeType,
pub confidence: f32,
}
#[derive(Debug, Clone)]
pub enum OutcomeType {
Solution,
Decision,
Example,
Error,
Recommendation,
}
#[derive(Debug, Default, Clone)]
pub struct InteractionPatterns {
pub user_message_count: usize,
pub average_user_message_length: usize,
pub complex_questions: usize,
pub simple_questions: usize,
pub technical_messages: usize,
pub preferred_response_style: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ThreadInfo {
pub thread_id: String,
pub title: Option<String>,
pub message_count: usize,
pub created_at: DateTime<Utc>,
pub last_activity: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SessionStats {
pub total_sessions: usize,
pub active_sessions: usize,
pub idle_sessions: usize,
pub expired_sessions: usize,
pub suspended_sessions: usize,
pub total_messages: usize,
pub total_tokens: usize,
pub avg_response_time_ms: f64,
pub uptime_seconds: u64,
}