mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
Docs + Code: rename ‘convo’ to ‘conversation’ across codebase and docs (#10447)
This commit is contained in:
parent
e2343c0927
commit
8401641f7e
|
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 113 KiB |
@ -65,7 +65,7 @@ To send follow-up messages for the same conversation, mention `@openhands` in a
|
||||
|
||||
Conversation is started by mentioning `@openhands`.
|
||||
|
||||

|
||||

|
||||
|
||||
### See agent response and send follow up messages
|
||||
|
||||
|
||||
@ -735,7 +735,7 @@ class KubernetesRuntime(ActionExecutionClient):
|
||||
@classmethod
|
||||
async def delete(cls, conversation_id: str):
|
||||
"""Delete resources associated with a conversation."""
|
||||
# This is triggered when you actually do the delete in the UI on the convo.
|
||||
# This is triggered when you actually do the delete in the UI on the conversation.
|
||||
try:
|
||||
cls._cleanup_k8s_resources(
|
||||
namespace=cls._namespace,
|
||||
|
||||
@ -21,7 +21,7 @@ from openhands.events.observation.agent import (
|
||||
from openhands.events.serialization import event_to_dict
|
||||
from openhands.integrations.service_types import ProviderType
|
||||
from openhands.server.services.conversation_service import (
|
||||
setup_init_convo_settings,
|
||||
setup_init_conversation_settings,
|
||||
)
|
||||
from openhands.server.shared import (
|
||||
conversation_manager,
|
||||
@ -117,7 +117,7 @@ async def connect(connection_id: str, environ: dict) -> None:
|
||||
f'Finished replaying event stream for conversation {conversation_id}'
|
||||
)
|
||||
|
||||
conversation_init_data = await setup_init_convo_settings(
|
||||
conversation_init_data = await setup_init_conversation_settings(
|
||||
user_id, conversation_id, providers_set
|
||||
)
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ from openhands.server.data_models.conversation_info_result_set import (
|
||||
from openhands.server.dependencies import get_dependencies
|
||||
from openhands.server.services.conversation_service import (
|
||||
create_new_conversation,
|
||||
setup_init_convo_settings,
|
||||
setup_init_conversation_settings,
|
||||
)
|
||||
from openhands.server.shared import (
|
||||
ConversationStoreImpl,
|
||||
@ -466,7 +466,7 @@ async def start_conversation(
|
||||
)
|
||||
|
||||
# Set up conversation init data with provider information
|
||||
conversation_init_data = await setup_init_convo_settings(
|
||||
conversation_init_data = await setup_init_conversation_settings(
|
||||
user_id, conversation_id, providers_set.providers_set or []
|
||||
)
|
||||
|
||||
|
||||
@ -28,21 +28,23 @@ mcp_server = FastMCP(
|
||||
)
|
||||
|
||||
HOST = f'https://{os.getenv("WEB_HOST", "app.all-hands.dev").strip()}'
|
||||
CONVO_URL = HOST + '/conversations/{}'
|
||||
CONVERSATION_URL = HOST + '/conversations/{}'
|
||||
|
||||
|
||||
async def get_convo_link(service: GitService, conversation_id: str, body: str) -> str:
|
||||
async def get_conversation_link(
|
||||
service: GitService, conversation_id: str, body: str
|
||||
) -> str:
|
||||
"""Appends a followup link, in the PR body, to the OpenHands conversation that opened the PR"""
|
||||
if server_config.app_mode != AppMode.SAAS:
|
||||
return body
|
||||
|
||||
user = await service.get_user()
|
||||
username = user.login
|
||||
convo_url = CONVO_URL.format(conversation_id)
|
||||
convo_link = (
|
||||
f'@{username} can click here to [continue refining the PR]({convo_url})'
|
||||
conversation_url = CONVERSATION_URL.format(conversation_id)
|
||||
conversation_link = (
|
||||
f'@{username} can click here to [continue refining the PR]({conversation_url})'
|
||||
)
|
||||
body += f'\n\n{convo_link}'
|
||||
body += f'\n\n{conversation_link}'
|
||||
return body
|
||||
|
||||
|
||||
@ -68,10 +70,12 @@ async def save_pr_metadata(
|
||||
pr_number = int(match_merge_request.group(1))
|
||||
|
||||
if pr_number:
|
||||
logger.info(f'Saving PR number: {pr_number} for convo {conversation_id}')
|
||||
logger.info(f'Saving PR number: {pr_number} for conversation {conversation_id}')
|
||||
conversation.pr_number.append(pr_number)
|
||||
else:
|
||||
logger.warning(f'Failed to extract PR number for convo {conversation_id}')
|
||||
logger.warning(
|
||||
f'Failed to extract PR number for conversation {conversation_id}'
|
||||
)
|
||||
|
||||
await conversation_store.save_metadata(conversation)
|
||||
|
||||
@ -116,9 +120,9 @@ async def create_pr(
|
||||
)
|
||||
|
||||
try:
|
||||
body = await get_convo_link(github_service, conversation_id, body or '')
|
||||
body = await get_conversation_link(github_service, conversation_id, body or '')
|
||||
except Exception as e:
|
||||
logger.warning(f'Failed to append convo link: {e}')
|
||||
logger.warning(f'Failed to append conversation link: {e}')
|
||||
|
||||
try:
|
||||
response = await github_service.create_pr(
|
||||
@ -186,11 +190,11 @@ async def create_mr(
|
||||
)
|
||||
|
||||
try:
|
||||
description = await get_convo_link(
|
||||
description = await get_conversation_link(
|
||||
gitlab_service, conversation_id, description or ''
|
||||
)
|
||||
except Exception as e:
|
||||
logger.warning(f'Failed to append convo link: {e}')
|
||||
logger.warning(f'Failed to append conversation link: {e}')
|
||||
|
||||
try:
|
||||
response = await gitlab_service.create_mr(
|
||||
@ -253,11 +257,11 @@ async def create_bitbucket_pr(
|
||||
)
|
||||
|
||||
try:
|
||||
description = await get_convo_link(
|
||||
description = await get_conversation_link(
|
||||
bitbucket_service, conversation_id, description or ''
|
||||
)
|
||||
except Exception as e:
|
||||
logger.warning(f'Failed to append convo link: {e}')
|
||||
logger.warning(f'Failed to append conversation link: {e}')
|
||||
|
||||
try:
|
||||
response = await bitbucket_service.create_pr(
|
||||
|
||||
@ -42,7 +42,7 @@ async def create_new_conversation(
|
||||
replay_json: str | None,
|
||||
conversation_instructions: str | None = None,
|
||||
conversation_trigger: ConversationTrigger = ConversationTrigger.GUI,
|
||||
attach_convo_id: bool = False,
|
||||
attach_conversation_id: bool = False,
|
||||
git_provider: ProviderType | None = None,
|
||||
conversation_id: str | None = None,
|
||||
mcp_config: MCPConfig | None = None,
|
||||
@ -133,8 +133,8 @@ async def create_new_conversation(
|
||||
image_urls=image_urls or [],
|
||||
)
|
||||
|
||||
if attach_convo_id:
|
||||
logger.warning('Attaching convo ID is deprecated, skipping process')
|
||||
if attach_conversation_id:
|
||||
logger.warning('Attaching conversation ID is deprecated, skipping process')
|
||||
|
||||
agent_loop_info = await conversation_manager.maybe_start_agent_loop(
|
||||
conversation_id,
|
||||
@ -159,7 +159,7 @@ def create_provider_tokens_object(
|
||||
return MappingProxyType(provider_information)
|
||||
|
||||
|
||||
async def setup_init_convo_settings(
|
||||
async def setup_init_conversation_settings(
|
||||
user_id: str | None, conversation_id: str, providers_set: list[ProviderType]
|
||||
) -> ConversationInitData:
|
||||
"""Set up conversation initialization data with provider tokens.
|
||||
@ -198,8 +198,8 @@ async def setup_init_convo_settings(
|
||||
if user_secrets:
|
||||
session_init_args['custom_secrets'] = user_secrets.custom_secrets
|
||||
|
||||
convo_init_data = ConversationInitData(**session_init_args)
|
||||
conversation_init_data = ConversationInitData(**session_init_args)
|
||||
# We should recreate the same experiment conditions when restarting a conversation
|
||||
return ExperimentManagerImpl.run_conversation_variant_test(
|
||||
user_id, conversation_id, convo_init_data
|
||||
user_id, conversation_id, conversation_init_data
|
||||
)
|
||||
|
||||
@ -3,13 +3,13 @@ from unittest.mock import AsyncMock, patch
|
||||
import pytest
|
||||
|
||||
from openhands.integrations.service_types import GitService
|
||||
from openhands.server.routes.mcp import get_convo_link
|
||||
from openhands.server.routes.mcp import get_conversation_link
|
||||
from openhands.server.types import AppMode
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_convo_link_non_saas_mode():
|
||||
"""Test get_convo_link in non-SAAS mode."""
|
||||
async def test_get_conversation_link_non_saas_mode():
|
||||
"""Test get_conversation_link in non-SAAS mode."""
|
||||
# Mock GitService
|
||||
mock_service = AsyncMock(spec=GitService)
|
||||
|
||||
@ -18,7 +18,7 @@ async def test_get_convo_link_non_saas_mode():
|
||||
mock_config.app_mode = AppMode.OSS
|
||||
|
||||
# Call the function
|
||||
result = await get_convo_link(
|
||||
result = await get_conversation_link(
|
||||
service=mock_service, conversation_id='test-convo-id', body='Original body'
|
||||
)
|
||||
|
||||
@ -29,8 +29,8 @@ async def test_get_convo_link_non_saas_mode():
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_convo_link_saas_mode():
|
||||
"""Test get_convo_link in SAAS mode."""
|
||||
async def test_get_conversation_link_saas_mode():
|
||||
"""Test get_conversation_link in SAAS mode."""
|
||||
# Mock GitService and user
|
||||
mock_service = AsyncMock(spec=GitService)
|
||||
mock_user = AsyncMock()
|
||||
@ -41,14 +41,14 @@ async def test_get_convo_link_saas_mode():
|
||||
with (
|
||||
patch('openhands.server.routes.mcp.server_config') as mock_config,
|
||||
patch(
|
||||
'openhands.server.routes.mcp.CONVO_URL',
|
||||
'openhands.server.routes.mcp.CONVERSATION_URL',
|
||||
'https://test.example.com/conversations/{}',
|
||||
),
|
||||
):
|
||||
mock_config.app_mode = AppMode.SAAS
|
||||
|
||||
# Call the function
|
||||
result = await get_convo_link(
|
||||
result = await get_conversation_link(
|
||||
service=mock_service, conversation_id='test-convo-id', body='Original body'
|
||||
)
|
||||
|
||||
@ -61,8 +61,8 @@ async def test_get_convo_link_saas_mode():
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_convo_link_empty_body():
|
||||
"""Test get_convo_link with an empty body."""
|
||||
async def test_get_conversation_link_empty_body():
|
||||
"""Test get_conversation_link with an empty body."""
|
||||
# Mock GitService and user
|
||||
mock_service = AsyncMock(spec=GitService)
|
||||
mock_user = AsyncMock()
|
||||
@ -73,14 +73,14 @@ async def test_get_convo_link_empty_body():
|
||||
with (
|
||||
patch('openhands.server.routes.mcp.server_config') as mock_config,
|
||||
patch(
|
||||
'openhands.server.routes.mcp.CONVO_URL',
|
||||
'openhands.server.routes.mcp.CONVERSATION_URL',
|
||||
'https://test.example.com/conversations/{}',
|
||||
),
|
||||
):
|
||||
mock_config.app_mode = AppMode.SAAS
|
||||
|
||||
# Call the function
|
||||
result = await get_convo_link(
|
||||
result = await get_conversation_link(
|
||||
service=mock_service, conversation_id='test-convo-id', body=''
|
||||
)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user