Place LangBot branding above DingTalk card content

This commit is contained in:
fdc310
2026-10-28 03:44:07 +08:00
parent 6a29ffe07f
commit 1b00a7aa40
6 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -122,7 +122,7 @@ def text_card_components() -> list[dict[str, typing.Any]]:
{
'id': 'root',
'component': 'Column',
'children': ['content', 'langbot-brand'],
'children': ['langbot-brand', 'content'],
'gap': 8,
},
{
@@ -150,7 +150,7 @@ def _build_interaction_messages(
)
children.append(button_id)
children.append('langbot-brand')
children.insert(0, 'langbot-brand')
components.extend(brand_components())
components.insert(0, {'id': 'root', 'component': 'Column', 'children': children, 'gap': 12})
return {'form': form}, components, field_types
+1 -1
View File
@@ -520,7 +520,7 @@ def _dingtalk_a2ui_form(
]
)
children.append(button_id)
children.append('langbot-brand')
children.insert(0, 'langbot-brand')
components.extend(brand_components())
return data, components
@@ -53,7 +53,7 @@ def test_dingtalk_dify_input_card_uses_a2ui_binding_and_required_check():
assert field['value'] == {'path': '/form/value'}
assert button['action']['event']['context']['input'] == {'path': '/form/value'}
assert button['checks'][0]['condition']['call'] == 'required'
assert components[0]['children'][-1] == 'langbot-brand'
assert components[0]['children'][0] == 'langbot-brand'
assert any(component['id'] == 'langbot-brand-link' for component in components)
@@ -35,7 +35,7 @@ def test_text_card_keeps_brand_when_content_updates():
components = create_text_card_messages('surface-id', 'hello')[2]['updateComponents']['components']
by_id = {component['id']: component for component in components}
assert by_id['root']['children'] == ['content', 'langbot-brand']
assert by_id['root']['children'] == ['langbot-brand', 'content']
assert by_id['langbot-brand']['children'] == ['langbot-brand-icon', 'langbot-brand-link']
assert by_id['langbot-brand-icon']['url'] == 'https://langbot.app/logo-blue.png'
assert by_id['langbot-brand-icon']['previewEnabled'] is False
@@ -342,7 +342,7 @@ async def test_dingtalk_interaction_delivery_and_callback_event():
components = kwargs['a2ui_messages'][2]['updateComponents']['components']
button = next(component for component in components if component['component'] == 'Button')
assert button['action']['event']['context']['actionId'] == 'lbi:callback-token:a:0'
assert components[0]['children'][-1] == 'langbot-brand'
assert components[0]['children'][0] == 'langbot-brand'
assert any(component['id'] == 'langbot-brand-link' for component in components)
native = dingtalk_card_callback_event(