feat: init
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
use crate::models::common::{ConversationType, JsonValue, Status, Visibility};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, sqlx::FromRow)]
|
||||
pub struct Conversation {
|
||||
pub id: Uuid,
|
||||
pub workspace_id: Option<Uuid>,
|
||||
pub repo_id: Option<Uuid>,
|
||||
pub issue_id: Option<Uuid>,
|
||||
pub pull_request_id: Option<Uuid>,
|
||||
pub agent_id: Option<Uuid>,
|
||||
pub created_by: Uuid,
|
||||
pub title: String,
|
||||
pub description: Option<String>,
|
||||
pub conversation_type: ConversationType,
|
||||
pub status: Status,
|
||||
pub visibility: Visibility,
|
||||
pub pinned: bool,
|
||||
pub archived: bool,
|
||||
pub metadata: Option<JsonValue>,
|
||||
pub last_message_id: Option<Uuid>,
|
||||
pub last_message_at: Option<DateTime<Utc>>,
|
||||
pub archived_at: Option<DateTime<Utc>>,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
pub deleted_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
use crate::models::json_types::{ConversationAttachmentMetadata, TypedJson};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, sqlx::FromRow)]
|
||||
pub struct ConversationAttachment {
|
||||
pub id: Uuid,
|
||||
pub conversation_id: Uuid,
|
||||
pub message_id: Option<Uuid>,
|
||||
pub file_id: Option<Uuid>,
|
||||
pub uploaded_by: Option<Uuid>,
|
||||
pub name: String,
|
||||
pub content_type: Option<String>,
|
||||
pub size_bytes: i64,
|
||||
pub storage_path: Option<String>,
|
||||
pub url: Option<String>,
|
||||
pub metadata: Option<TypedJson<ConversationAttachmentMetadata>>,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub deleted_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, sqlx::FromRow)]
|
||||
pub struct ConversationBookmark {
|
||||
pub id: Uuid,
|
||||
pub conversation_id: Uuid,
|
||||
pub message_id: Option<Uuid>,
|
||||
pub user_id: Uuid,
|
||||
pub title: Option<String>,
|
||||
pub note: Option<String>,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
use crate::models::common::{ContentFormat, JsonValue, MessageRole, MessageType, Status};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, sqlx::FromRow)]
|
||||
pub struct ConversationMessage {
|
||||
pub id: Uuid,
|
||||
pub conversation_id: Uuid,
|
||||
pub parent_message_id: Option<Uuid>,
|
||||
pub author_id: Option<Uuid>,
|
||||
pub agent_id: Option<Uuid>,
|
||||
pub ai_model_id: Option<Uuid>,
|
||||
pub role: MessageRole,
|
||||
pub message_type: MessageType,
|
||||
pub content: String,
|
||||
pub content_format: ContentFormat,
|
||||
pub status: Status,
|
||||
pub metadata: Option<JsonValue>,
|
||||
pub token_input_count: Option<i32>,
|
||||
pub token_output_count: Option<i32>,
|
||||
pub edited_at: Option<DateTime<Utc>>,
|
||||
pub deleted_at: Option<DateTime<Utc>>,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
use crate::models::common::{ParticipantType, Role, Status};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, sqlx::FromRow)]
|
||||
pub struct ConversationParticipant {
|
||||
pub id: Uuid,
|
||||
pub conversation_id: Uuid,
|
||||
pub user_id: Option<Uuid>,
|
||||
pub agent_id: Option<Uuid>,
|
||||
pub role: Role,
|
||||
pub participant_type: ParticipantType,
|
||||
pub status: Status,
|
||||
pub muted: bool,
|
||||
pub last_read_message_id: Option<Uuid>,
|
||||
pub last_read_at: Option<DateTime<Utc>>,
|
||||
pub joined_at: Option<DateTime<Utc>>,
|
||||
pub left_at: Option<DateTime<Utc>>,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
use crate::models::common::{JsonValue, SummaryType};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, sqlx::FromRow)]
|
||||
pub struct ConversationSummary {
|
||||
pub id: Uuid,
|
||||
pub conversation_id: Uuid,
|
||||
pub ai_model_id: Option<Uuid>,
|
||||
pub generated_by: Option<Uuid>,
|
||||
pub from_message_id: Option<Uuid>,
|
||||
pub to_message_id: Option<Uuid>,
|
||||
pub summary_type: SummaryType,
|
||||
pub content: String,
|
||||
pub token_count: Option<i32>,
|
||||
pub metadata: Option<JsonValue>,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
use crate::models::common::{JsonValue, Status};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, sqlx::FromRow)]
|
||||
pub struct ConversationToolCall {
|
||||
pub id: Uuid,
|
||||
pub conversation_id: Uuid,
|
||||
pub message_id: Uuid,
|
||||
pub agent_id: Option<Uuid>,
|
||||
pub tool_name: String,
|
||||
pub call_id: Option<String>,
|
||||
pub status: Status,
|
||||
pub arguments: Option<JsonValue>,
|
||||
pub result: Option<JsonValue>,
|
||||
pub error_message: Option<String>,
|
||||
pub started_at: Option<DateTime<Utc>>,
|
||||
pub finished_at: Option<DateTime<Utc>>,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
pub mod conversation;
|
||||
pub mod conversation_attachments;
|
||||
pub mod conversation_bookmarks;
|
||||
pub mod conversation_messages;
|
||||
pub mod conversation_participants;
|
||||
pub mod conversation_summaries;
|
||||
pub mod conversation_tool_calls;
|
||||
|
||||
pub use conversation::Conversation;
|
||||
pub use conversation_attachments::ConversationAttachment;
|
||||
pub use conversation_bookmarks::ConversationBookmark;
|
||||
pub use conversation_messages::ConversationMessage;
|
||||
pub use conversation_participants::ConversationParticipant;
|
||||
pub use conversation_summaries::ConversationSummary;
|
||||
pub use conversation_tool_calls::ConversationToolCall;
|
||||
Reference in New Issue
Block a user