gitdataai/libs/transport/event/voice.rs
ZhenYi 14f6e1e500 feat(core): initialize project with access control and AI integration
- Add gitignore and prettier configuration files for project scaffolding
- Implement room access control service with project member verification
- Create user access key management with CRUD operations and activity logging
- Add accordion UI component for frontend expandable sections
- Implement room AI configuration with list, upsert, and delete operations
- Add AI event types for agent join/leave/status change tracking
- Create streaming AI processing services for mode and react patterns
- Build room AI service with model detection and idempotency handling
- Integrate chat service orchestration for AI message processing
- Add typing indicators and stream cancellation for AI interactions
- Implement mention parsing and context extraction for AI agents
2026-05-03 06:04:31 +08:00

117 lines
2.8 KiB
Rust

use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use models::{ProjectId, RoomId, UserId};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum VoiceEventType {
ChannelJoined,
ChannelLeft,
MuteUpdated,
DeafUpdated,
ScreenShareStarted,
ScreenShareStopped,
SpeakingStarted,
SpeakingStopped,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum VoiceEvent {
ChannelJoined(VoiceChannelJoinedService),
ChannelLeft(VoiceChannelLeftService),
MuteUpdated(VoiceMuteUpdatedService),
DeafUpdated(VoiceDeafUpdatedService),
ScreenShareStarted(ScreenShareStartedService),
ScreenShareStopped(ScreenShareStoppedService),
SpeakingStarted(SpeakingStartedService),
SpeakingStopped(SpeakingStoppedService),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VoiceChannelJoinedService {
pub room: RoomId,
pub project: ProjectId,
pub user: UserId,
pub muted: bool,
pub deafened: bool,
pub video: bool,
pub joined_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VoiceChannelLeftService {
pub room: RoomId,
pub project: ProjectId,
pub user: UserId,
pub left_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VoiceMuteUpdatedService {
pub room: RoomId,
pub user: UserId,
pub muted: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VoiceDeafUpdatedService {
pub room: RoomId,
pub user: UserId,
pub deafened: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ScreenShareStartedService {
pub room: RoomId,
pub user: UserId,
pub started_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ScreenShareStoppedService {
pub room: RoomId,
pub user: UserId,
pub stopped_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SpeakingStartedService {
pub room: RoomId,
pub user: UserId,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SpeakingStoppedService {
pub room: RoomId,
pub user: UserId,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct VoiceJoinClient {
pub room: RoomId,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct VoiceLeaveClient {
pub room: RoomId,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct VoiceMuteClient {
pub room: RoomId,
pub muted: bool,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct VoiceDeafClient {
pub room: RoomId,
pub deafened: bool,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ScreenShareClient {
pub room: RoomId,
pub start: bool,
}