- Add LiteLLM provider with LLM_PROVIDER env var support - Add Fake LLM provider for testing - Add action registry with 17 AI actions - Add permission checker with role verification - Add UI events in chat responses (fill_form, open_preview, etc) - Add versioned prompt files system - Add confirm action endpoint - Add 80 unit tests New endpoints: - POST /api/ai/actions/confirm New files: - src/handlers/actions.rs - src/handlers/confirm_action.rs - src/services/action_confirmation.rs - src/prompts.rs - src/tests.rs - prompts/v1/*.txt
32 lines
930 B
Rust
32 lines
930 B
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
|
pub struct ConfirmActionRequest {
|
|
pub conversation_id: String,
|
|
pub action: String,
|
|
pub confirmed: bool,
|
|
#[serde(default)]
|
|
pub fields: serde_json::Value,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize)]
|
|
pub struct ConfirmActionResponse {
|
|
pub success: bool,
|
|
pub message: String,
|
|
pub action: String,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub record_id: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub ui_events: Option<Vec<UiEvent>>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct UiEvent {
|
|
#[serde(rename = "type")]
|
|
pub event_type: String,
|
|
pub target: String,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub record_id: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub fields: Option<serde_json::Value>,
|
|
}
|