mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
fix: app unawareness of custom secrets in v1 conversations (#11914)
This commit is contained in:
parent
f7c3a36745
commit
09e50b876d
@ -650,6 +650,7 @@ class LiveStatusAppConversationService(AppConversationServiceBase):
|
||||
system_message_suffix: str | None,
|
||||
mcp_config: dict,
|
||||
condenser_max_size: int | None,
|
||||
secrets: dict | None = None,
|
||||
) -> Agent:
|
||||
"""Create an agent with appropriate tools and context based on agent type.
|
||||
|
||||
@ -659,6 +660,7 @@ class LiveStatusAppConversationService(AppConversationServiceBase):
|
||||
system_message_suffix: Optional suffix for system messages
|
||||
mcp_config: MCP configuration dictionary
|
||||
condenser_max_size: condenser_max_size setting
|
||||
secrets: Optional dictionary of secrets for authentication
|
||||
|
||||
Returns:
|
||||
Configured Agent instance with context
|
||||
@ -687,7 +689,9 @@ class LiveStatusAppConversationService(AppConversationServiceBase):
|
||||
)
|
||||
|
||||
# Add agent context
|
||||
agent_context = AgentContext(system_message_suffix=system_message_suffix)
|
||||
agent_context = AgentContext(
|
||||
system_message_suffix=system_message_suffix, secrets=secrets
|
||||
)
|
||||
agent = agent.model_copy(update={'agent_context': agent_context})
|
||||
|
||||
return agent
|
||||
@ -784,7 +788,12 @@ class LiveStatusAppConversationService(AppConversationServiceBase):
|
||||
|
||||
# Create agent with context
|
||||
agent = self._create_agent_with_context(
|
||||
llm, agent_type, system_message_suffix, mcp_config, user.condenser_max_size
|
||||
llm,
|
||||
agent_type,
|
||||
system_message_suffix,
|
||||
mcp_config,
|
||||
user.condenser_max_size,
|
||||
secrets=secrets,
|
||||
)
|
||||
|
||||
# Finalize and return the conversation request
|
||||
|
||||
@ -821,5 +821,6 @@ class TestLiveStatusAppConversationService:
|
||||
'Test suffix',
|
||||
mock_mcp_config,
|
||||
self.mock_user.condenser_max_size,
|
||||
secrets=mock_secrets,
|
||||
)
|
||||
self.service._finalize_conversation_request.assert_called_once()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user