[Add] AiResponse
This commit is contained in:
parent
50dea26a74
commit
f63722f67c
3 changed files with 24 additions and 0 deletions
|
|
@ -11,6 +11,7 @@ thiserror = "2"
|
|||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
stp-core = { git = "https://git.methanium.net/shoal/stp.git" }
|
||||
tokio = "1"
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
|
|
|
|||
21
src/ai_response.rs
Normal file
21
src/ai_response.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Message {
|
||||
pub user: bool,
|
||||
pub content: String,
|
||||
}
|
||||
|
||||
pub type Conversation = Arc<RwLock<AiConversation>>;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AiConversation {
|
||||
pub model: String,
|
||||
pub messages: Vec<Message>,
|
||||
pub max_tokens: u32,
|
||||
pub temperature: f32,
|
||||
pub stream: bool,
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ pub use chrono::{DateTime, Utc};
|
|||
pub use stp_core::{CommunicationType, CommunicationValue, DataTypes, DataValue};
|
||||
pub use uuid::Uuid;
|
||||
|
||||
pub mod ai_response;
|
||||
pub mod coral;
|
||||
pub mod enums;
|
||||
pub mod errors;
|
||||
|
|
@ -10,6 +11,7 @@ pub mod project;
|
|||
pub mod task;
|
||||
pub mod todo;
|
||||
|
||||
pub use ai_response::{Conversation, Message};
|
||||
pub use coral::{Coral, CoralId};
|
||||
pub use enums::*;
|
||||
pub use errors::{ShoalError, ValidationError};
|
||||
|
|
|
|||
Loading…
Reference in a new issue