mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-09-07 01:57:15 +00:00
0755beebcd
* feat: Implement workflow form handling for paused workflows - Added module-level storage for pending forms to manage state across sessions. - Introduced functions to set, get, and clear pending forms with expiration handling. - Enhanced DifyServiceAPIRunner to support resuming paused workflows via form actions. - Implemented logic to yield human input requests and display appropriate messages. - Updated workflow submission methods to handle paused states and resume actions. - Ensured proper merging of pending form actions with user inputs for seamless interaction. * feat: Add '_routed_by_rule' variable to form action in Lark and Telegram adapters * feat: Enhance Lark and Telegram adapters with new form handling for paused workflows * feat: Enhance TelegramAdapter to handle form action buttons and message threading * feat: Improve TelegramAdapter message handling with enhanced error management and draft message support * feat: Add the function for formatting human input text to support adapters without rich UI. * feat(dingtalk): implement human input card support and card action handling - Add a new module `card_callback.py` to handle card action button clicks from DingTalk. - Introduce `DingTalkCardActionHandler` to process card action callbacks and extract parameters. - Update `DingTalkAdapter` to manage card state and handle form input through a single card template. - Add configuration for `human_input_card_template_id` in `dingtalk.yaml` to specify the template for human input. - Create a new card template `dingtalk_human_input_card.json` for rendering human input prompts and buttons. * feat(dingtalk): enhance human input card functionality with streaming support and active turn management - Updated the DingTalk card template to enable streaming mode and multi-update configuration. - Removed the obsolete delete_card method from DingTalkClient to streamline card management. - Enhanced DingTalkAdapter to manage active turn cards and accumulated streaming text, ensuring a seamless user experience during human input prompts. - Modified the create_message_card method to utilize existing active cards for resumed workflows, preventing duplication. - Improved the _paint_form_on_card method to update existing cards with human input prompts and buttons dynamically. - Updated the dingtalk_human_input_card.json template to reflect the new streaming capabilities and configuration options. * feat(wecom): implement Dify human input pause handling with button interaction support * feat(qqofficial): implement Dify human input button interaction handling and markdown keyboard support * feat(qqofficial): implement one-click QR binding and enhance localization support * feat(discord): implement Discord form view with button interactions for Dify actions * fix(telegram): correct group chat type check and handle oversized callback data for Telegram actions fix(difysvapi): ensure safe access to remove-think configuration in pipeline settings * feat(dify): add support for chatflow app type and enhance human input handling * feat(telegram): add action title feedback for user selections in Telegram messages * feat(lark): enhance LarkAdapter to store form content for resume notices * feat(dingtalk): update display formatting for card content with HTML line breaks * feat(dingtalk): add feedback functionality to cards with 👍/👎 buttons - Implemented feedback state management for cards, allowing users to provide feedback via thumbs up/down buttons. - Enhanced card rendering to include feedback buttons when appropriate. - Registered feedback listeners to handle feedback events and update card states accordingly. - Updated the card template to support dynamic button rendering for feedback actions. - Improved error handling and logging for feedback actions and card updates. * fix: add Avatar component to dingtalk_human_input_card.json for enhanced user interaction * feat(wecom): add optional source block to interactive template cards for enhanced branding * feat(wecom): add functions for template card action extraction and update, enhance button interaction handling * feat(qqofficial): synchronize passive-reply counter with inbound message sequence * feat(qqofficial): add method to identify invisible form placeholder chunks in messages * feat(dingtalk): add download link for human input card template and enhance dynamic form configuration * feat(telegram): enhance message handling with group stream deletion and form placeholder detection * Add unit tests for DingTalk, Lark, WeComBot, and Dify service API runners - Implement tests for DingTalk adapter helper functions including form content cleaning, input extraction, and completed input lines. - Create unit tests for Lark adapter helper functions focusing on input extraction and completed input lines. - Add tests for WeComBot template card functionalities, including event extraction and payload building for human input. - Enhance Dify service API runner tests to cover human input forms, including input collection, action handling, and form snapshot extraction. * feat: Enhance Telegram and QQ Official adapters with select field handling and form action processing - Added support for select fields in Telegram adapter, including option extraction and callback handling. - Implemented form action processing for Telegram callbacks, improving user interaction feedback. - Introduced new helper functions for building keyboards and resolving select button actions in QQ Official adapter. - Enhanced DifyServiceAPIRunner to handle cumulative streaming responses and improve error handling during workflow resumes. - Added unit tests for new functionalities in Telegram and QQ Official adapters, ensuring robust behavior for select fields and form actions. * feat(lark): add functions for current input definitions and visible form content handling feat(qqofficial): update fallback text handling for non-streaming scenarios feat(difysvapi): enhance form content processing for interactive fields and actions test: add unit tests for Lark and QQ Official adapter functionalities * Add tests for DingTalk adapter content processing and markdown formatting - Updated the assertion in `test_dingtalk_completed_input_lines_include_text_and_select_values` to remove unnecessary markdown formatting. - Added new tests to verify that `_dingtalk_clean_form_content` maintains the order of prompts and completed values in various scenarios. - Introduced `test_dingtalk_card_markdown_preserves_internal_line_breaks` to ensure internal line breaks are correctly converted to HTML line breaks. * feat: Refactor input handling and feedback messages across multiple adapters * feat: Update the human-computer interaction template cards, and optimize the prompt information and content display. * feat: Refactor pending form handling to isolate by bot and pipeline * feat: Enhance error handling and caching for Dify and WeCom interactions * feat: Enhance select input handling and validation in Dify API runner and Telegram adapter * feat: Add missing completed input lines handling in DingTalk adapter * feat: Add pipeline_uuid handling across multiple adapters and update related tests
145 lines
6.0 KiB
YAML
145 lines
6.0 KiB
YAML
apiVersion: v1
|
|
kind: MessagePlatformAdapter
|
|
metadata:
|
|
name: dingtalk
|
|
label:
|
|
en_US: DingTalk
|
|
zh_Hans: 钉钉
|
|
zh_Hant: 釘釘
|
|
description:
|
|
en_US: DingTalk Adapter
|
|
zh_Hans: 钉钉适配器,请查看文档了解使用方式
|
|
zh_Hant: 釘釘適配器,請查看文件了解使用方式
|
|
icon: dingtalk.svg
|
|
spec:
|
|
categories:
|
|
- china
|
|
help_links:
|
|
zh: https://link.langbot.app/zh/platforms/dingtalk
|
|
en: https://link.langbot.app/en/platforms/dingtalk
|
|
ja: https://link.langbot.app/ja/platforms/dingtalk
|
|
config:
|
|
- name: one-click-create
|
|
label:
|
|
en_US: One-Click Create App
|
|
zh_Hans: 一键创建应用
|
|
zh_Hant: 一鍵建立應用
|
|
description:
|
|
en_US: "Scan QR code with DingTalk to automatically create an app and fill in credentials. Note: Robot Code cannot be obtained automatically, you need to copy it from the DingTalk Developer Backend manually."
|
|
zh_Hans: "使用钉钉扫码自动创建应用并填写凭据。注意:机器人代码无法自动获取,需前往钉钉开发者后台手动复制。"
|
|
zh_Hant: "使用釘釘掃碼自動建立應用並填寫憑證。注意:機器人代碼無法自動取得,需前往釘釘開發者後台手動複製。"
|
|
type: qr-code-login
|
|
login_platform: dingtalk
|
|
required: false
|
|
- name: client_id
|
|
label:
|
|
en_US: Client ID
|
|
zh_Hans: 客户端ID
|
|
zh_Hant: 用戶端ID
|
|
type: string
|
|
required: true
|
|
default: ""
|
|
- name: client_secret
|
|
label:
|
|
en_US: Client Secret
|
|
zh_Hans: 客户端密钥
|
|
zh_Hant: 用戶端密鑰
|
|
type: string
|
|
required: true
|
|
default: ""
|
|
- name: robot_code
|
|
label:
|
|
en_US: Robot Code
|
|
zh_Hans: 机器人代码
|
|
zh_Hant: 機器人代碼
|
|
description:
|
|
en_US: "Required for image recognition, file upload and other features. Get it from DingTalk Developer Backend > Robot Configuration."
|
|
zh_Hans: "识图、上传文件等功能必填。请前往钉钉开发者后台 > 机器人配置中获取。"
|
|
zh_Hant: "識圖、上傳檔案等功能必填。請前往釘釘開發者後台 > 機器人設定中取得。"
|
|
type: string
|
|
required: true
|
|
default: ""
|
|
- name: robot_name
|
|
label:
|
|
en_US: Robot Name
|
|
zh_Hans: 机器人名称
|
|
zh_Hant: 機器人名稱
|
|
type: string
|
|
required: true
|
|
default: ""
|
|
- name: markdown_card
|
|
label:
|
|
en_US: Markdown Card
|
|
zh_Hans: 是否使用 Markdown 卡片
|
|
zh_Hant: 是否使用 Markdown 卡片
|
|
type: boolean
|
|
required: false
|
|
default: true
|
|
- name: enable-stream-reply
|
|
label:
|
|
en_US: Enable Stream Reply Mode
|
|
zh_Hans: 启用钉钉卡片流式回复模式
|
|
zh_Hant: 啟用釘釘卡片串流回覆模式
|
|
description:
|
|
en_US: If enabled, the bot will use the stream of lark reply mode
|
|
zh_Hans: 如果启用,将使用钉钉卡片流式方式来回复内容
|
|
zh_Hant: 如果啟用,將使用釘釘卡片串流方式來回覆內容
|
|
type: boolean
|
|
required: true
|
|
default: false
|
|
- name: card_auto_layout
|
|
label:
|
|
en_US: Card Auto Layout
|
|
zh_Hans: 卡片宽屏自动布局
|
|
zh_Hant: 卡片寬螢幕自動佈局
|
|
type: boolean
|
|
required: false
|
|
default: false
|
|
- name: card_template_id
|
|
label:
|
|
en_US: card template id
|
|
zh_Hans: 卡片模板ID
|
|
zh_Hant: 卡片範本ID
|
|
type: string
|
|
required: true
|
|
default: "填写你的卡片template_id"
|
|
- name: human_input_card_template_download
|
|
label:
|
|
en_US: Download Human Input Card Template
|
|
zh_Hans: 下载人工输入卡片模板
|
|
zh_Hant: 下載人工輸入卡片範本
|
|
description:
|
|
en_US: "Used as the only card template ID for the whole conversation turn. Download the built-in template, then import the JSON in DingTalk Open Platform > Card Platform / Card Template Management. After DingTalk creates the template, copy its template ID into the field below. The template already wires `content` (MarkdownBlock) and `btns` (ButtonGroup). Leave empty to fall back to the legacy two-card behavior."
|
|
zh_Hans: "用作整个对话回合唯一卡片的模板 ID。先下载内置模板,再到钉钉开放平台 > 卡片平台 / 卡片模板管理中导入该 JSON;钉钉生成模板后,将模板 ID 填到这里。模板已预先连好 `content` (MarkdownBlock) 与 `btns` (ButtonGroup)。留空则降级为旧的双卡行为。"
|
|
zh_Hant: "用作整個對話回合唯一卡片的範本 ID。先下載內建範本,再到釘釘開放平台 > 卡片平台 / 卡片範本管理中匯入該 JSON;釘釘產生範本後,將範本 ID 填到這裡。範本已預先連好 `content` (MarkdownBlock) 與 `btns` (ButtonGroup)。留空則降級為舊的雙卡行為。"
|
|
type: download-link
|
|
required: false
|
|
default: ""
|
|
url: /api/v1/platform/adapters/dingtalk/human-input-card-template
|
|
download_filename: dingtalk_human_input_card.json
|
|
help_links:
|
|
zh: https://open-dev.dingtalk.com/fe/card
|
|
en: https://open-dev.dingtalk.com/fe/card
|
|
ja: https://open-dev.dingtalk.com/fe/card
|
|
help_label:
|
|
en_US: Import Guide
|
|
zh_Hans: 导入指引
|
|
zh_Hant: 匯入指引
|
|
ja_JP: インポート手順
|
|
- name: human_input_card_template_id
|
|
label:
|
|
en_US: Human Input Card Template ID
|
|
zh_Hans: 人工输入卡片模板ID
|
|
zh_Hant: 人工輸入卡片範本ID
|
|
description:
|
|
en_US: "Paste the template ID generated after importing the human input card template."
|
|
zh_Hans: "填写导入人工输入卡片模板后生成的模板 ID。"
|
|
zh_Hant: "填寫匯入人工輸入卡片範本後產生的範本 ID。"
|
|
type: string
|
|
required: false
|
|
default: ""
|
|
execution:
|
|
python:
|
|
path: ./dingtalk.py
|
|
attr: DingTalkAdapter
|