Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
nygrenh committed Oct 3, 2024
1 parent 52c67a8 commit 75d932e
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 7 deletions.
21 changes: 21 additions & 0 deletions services/headless-lms/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions services/headless-lms/chatbot/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[package]
name = "headless-lms-chatbot"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true

[dependencies]
headless-lms-utils = { path = "../utils" }
headless-lms-models = { path = "../models" }

# Date and time library for Rust
chrono = { version = "0.4.34", features = ["serde"] }
# An implementation of futures and streams featuring zero allocations, composability, and itera…
futures = "0.3.30"
# Common utilities and extension traits for the futures-rs library.
futures-util = "0.3.30"
# An event-driven, non-blocking I/O platform for writing asynchronous I/O backed applications.
tokio.workspace = true
# Utilities for working with Tokio.
tokio-util = "0.7.10"
# higher level HTTP client library
reqwest = { version = "0.12.4", features = ["brotli", "gzip", "json", "http2", "rustls-tls", "stream"] }
# A generic serialization/deserialization framework
serde = { version = "1.0.197", features = ["derive"] }
# A JSON serialization file format
serde_json = "1.0.114"
# Application-level tracing for Rust.
tracing = "0.1.40"
# A library to generate and parse UUIDs.
uuid = { version = "1.7.0", features = ["serde", "v4", "v5"] }
# Flexible concrete Error type built on std::error::Error
anyhow = "1.0.80"
# 🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries
sqlx.workspace = true
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ use headless_lms_models::chatbot_conversation_messages::ChatbotConversationMessa
use headless_lms_utils::http::REQWEST_CLIENT;
use reqwest::header::HeaderMap;
use serde::{Deserialize, Serialize};
use sqlx::PgPool;
use tokio::{io::AsyncBufReadExt, sync::Mutex};
use tokio_util::io::StreamReader;
use web::Bytes;

use actix_web::web;

use crate::prelude::*;

Expand Down Expand Up @@ -98,7 +96,7 @@ pub struct ChatReponse {
struct RequestCancelledGuard {
response_message_id: Uuid,
received_string: Arc<Mutex<Vec<String>>>,
pool: web::Data<PgPool>,
pool: PgPool,
done: Arc<AtomicBool>,
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::prelude::*;
use headless_lms_utils::http::REQWEST_CLIENT;
use headless_lms_utils::{http::REQWEST_CLIENT, ApplicationConfiguration};
use serde::{Deserialize, Serialize};

const API_VERSION: &str = "2024-07-01";
Expand Down
5 changes: 5 additions & 0 deletions services/headless-lms/chatbot/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//! For chatbot-related features.

pub mod azure_chatbot;
pub mod azure_search_index;
pub(crate) mod prelude;
3 changes: 3 additions & 0 deletions services/headless-lms/chatbot/src/prelude.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub use serde::{Deserialize, Serialize};
pub use tracing::{error, info, warn};
pub use uuid::Uuid;
1 change: 1 addition & 0 deletions services/headless-lms/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ license.workspace = true
headless-lms-certificates = { path = "../certificates" }
headless-lms-models = { path = "../models" }
headless-lms-utils = { path = "../utils" }
headless-lms-chatbot = { path = "../chatbot" }
mooc-langs-api = { path = "../langs-api" }
doc-macro = { path = "../doc-macro" }

Expand Down
2 changes: 0 additions & 2 deletions services/headless-lms/server/src/domain/chatbot/mod.rs

This file was deleted.

0 comments on commit 75d932e

Please sign in to comment.