Files
imphnen-backend-service/imphnen-dimentorin/src/ai_agent/infrastructure/http/routes.rs
T

19 lines
755 B
Rust
Raw Normal View History

use super::handlers::{post_chat, post_index_material, post_reindex_all};
use crate::ai_agent::application::RagServiceImpl;
use crate::ai_agent::domain::RagService;
use crate::ai_agent::infrastructure::QdrantRagRepository;
use axum::{Extension, Router, routing::post};
use imphnen_libs::AppState;
use sea_orm::DatabaseConnection;
use std::sync::Arc;
pub fn ai_agent_routes(db: DatabaseConnection, _state: Arc<AppState>) -> Router {
let repo = Arc::new(QdrantRagRepository::new());
let service: Arc<dyn RagService> = Arc::new(RagServiceImpl::new(repo, db));
Router::new()
.route("/ai/chat", post(post_chat))
.route("/ai/materials/{id}/index", post(post_index_material))
.route("/ai/reindex", post(post_reindex_all))
.layer(Extension(service))
}