Refactor subagent and workflow domain models; migrate access tiers and events to domain module
- Moved `AccessTier` and `SubagentEvent` enums to `zesdex_domain::subagent`. - Consolidated workflow-related types into `zesdex_domain::workflow`. - Updated references across the codebase to use the new domain models. - Refactored tool execution logic to utilize a new `ToolExecutor` trait. - Enhanced `AgentTurnService` to handle tool calls and events more effectively. - Adjusted API handlers and state management to align with new domain structure.
This commit is contained in:
@@ -121,7 +121,7 @@ pub async fn chat_completions_handler(
|
||||
let llm_client = if model == state.llm_client.model {
|
||||
&state.llm_client
|
||||
} else {
|
||||
temp_client = zesdex_infrastructure::llm::LlmClient::new(
|
||||
temp_client = zesdex_infrastructure::llm::provider::LlmClient::new(
|
||||
state.llm_client.api_key.clone(),
|
||||
model,
|
||||
Some(state.llm_client.base_url.clone()),
|
||||
@@ -129,14 +129,14 @@ pub async fn chat_completions_handler(
|
||||
&temp_client
|
||||
};
|
||||
|
||||
use zesdex_application::ports::ProviderService;
|
||||
let (response, usage) = llm_client
|
||||
.chat_with_tools_non_streaming(
|
||||
.chat(
|
||||
&messages,
|
||||
None, // No tool definitions for basic chat
|
||||
req.max_tokens,
|
||||
req.temperature,
|
||||
None, // No abort flag
|
||||
)
|
||||
).await
|
||||
.map_err(|e| ApiError::ChatProxy(format!("LLM request failed: {e}")))?;
|
||||
|
||||
let (prompt_tokens, completion_tokens) = usage.unwrap_or((0, 0));
|
||||
|
||||
@@ -194,7 +194,7 @@ pub struct ApiState {
|
||||
pub token_service: JwtTokenService,
|
||||
|
||||
/// LLM provider client for chat completions.
|
||||
pub llm_client: zesdex_infrastructure::llm::LlmClient,
|
||||
pub llm_client: zesdex_infrastructure::llm::provider::LlmClient,
|
||||
}
|
||||
|
||||
impl fmt::Debug for ApiState {
|
||||
@@ -272,7 +272,7 @@ impl ApiState {
|
||||
zesdex_application::cms::MemoryServiceImpl::new(memory_repo, memory_dir);
|
||||
|
||||
let token_service = JwtTokenService::new(&jwt_secret);
|
||||
let llm_client = zesdex_infrastructure::llm::LlmClient::new(
|
||||
let llm_client = zesdex_infrastructure::llm::provider::LlmClient::new(
|
||||
llm_api_key.into(),
|
||||
llm_model.into(),
|
||||
llm_base_url,
|
||||
|
||||
Reference in New Issue
Block a user