Commit Graph

1024 Commits

Author SHA1 Message Date
nanobot-contributor
6fb4204ac6 fix(memory): handle list type tool call arguments
Some LLM providers return tool_calls[0].arguments as a list instead of
dict or str. Add handling to extract the first dict element from the list.

Fixes /new command warning: 'unexpected arguments type list'
2026-03-06 11:47:00 +08:00
PiKaqqqqqq
c3526a7fdb fix(feishu): smart message format selection (fixes #1548)
Instead of always sending interactive cards, detect the optimal
message format based on content:
- text: short plain text (≤200 chars, no markdown)
- post: medium text with links (≤2000 chars)
- interactive: complex content (code, tables, headings, bold, lists)
2026-03-06 10:11:53 +08:00
nanobot-contributor
9ab4155991 fix(cli): add Windows compatibility for signal handlers (PR #1400)
SIGHUP and SIGPIPE are not available on Windows. Add hasattr() checks
before registering these signal handlers to prevent AttributeError on
Windows systems.

Fixes compatibility issue introduced in PR #1400.
2026-03-06 09:57:03 +08:00
pikaqqqqqq
5ced08b1f2 fix(feishu): use msg_type "media" for mp4 video files
Previously, mp4 video files were sent with msg_type "file", which meant
users had to download them to play. Feishu requires msg_type "media" for
audio and video files to enable inline playback in the chat.

Changes:
- Add _VIDEO_EXTS constant for video file extensions (.mp4, .mov, .avi)
- Use msg_type "media" for both audio (_AUDIO_EXTS) and video (_VIDEO_EXTS)
- Keep msg_type "file" for documents and other file types

The upload_file API already uses file_type="mp4" for video files via the
existing _FILE_TYPE_MAP, so only the send msg_type needed fixing.
2026-03-06 01:54:00 +08:00
Re-bin
c8f86fd052 Merge PR #1384: fix(feishu): split card messages when content has multiple tables 2026-03-05 15:21:19 +00:00
Re-bin
573fc7cd95 Merge remote-tracking branch 'origin/main' into pr-1384 2026-03-05 15:19:50 +00:00
Re-bin
68a1a0268d Merge PR #1522: feat(telegram): implement draft/progress streaming messages 2026-03-05 15:17:30 +00:00
Re-bin
d32c6f946c fix(telegram): pin ptb>=22.6, fix double progress, clean up stale hatch config 2026-03-05 15:17:30 +00:00
Re-bin
b070ae5b2b Merge remote-tracking branch 'origin/main' into pr-1522 2026-03-05 15:05:26 +00:00
Re-bin
80392d158a Merge PR #1400: fix: add SIGTERM, SIGHUP handling and ignore SIGPIPE 2026-03-05 14:59:03 +00:00
Re-bin
4ba8d137bc Merge remote-tracking branch 'origin/main' into pr-1400 2026-03-05 14:56:18 +00:00
Re-bin
bea0f2a15d Merge PR #1435: feat(gateway): support multiple instances with --workspace and --config options 2026-03-05 14:54:53 +00:00
Re-bin
0343d66224 fix(gateway): remove duplicate load_config() that overwrote custom workspace/config 2026-03-05 14:54:53 +00:00
Re-bin
6d342fe79d Merge remote-tracking branch 'origin/main' into pr-1435 2026-03-05 14:51:13 +00:00
Re-bin
cd0bcc162e docs: update introduction of nanobot 2026-03-05 14:48:57 +00:00
Re-bin
57d8aefc22 docs: update introduction of nanobot 2026-03-05 14:46:03 +00:00
Re-bin
ec7bc33441 Merge PR #1488: feat(mcp): add SSE transport support with auto-detection 2026-03-05 14:44:45 +00:00
Re-bin
b71c1bdca7 fix(mcp): hoist sse/http imports, annotate auto-detection heuristic, restore field comments 2026-03-05 14:44:45 +00:00
Re-bin
2306d4c11c Merge remote-tracking branch 'origin/main' into pr-1488 2026-03-05 14:35:02 +00:00
Re-bin
c0d10cb508 Merge PR #553: feat(discord): add group policy to control group respond behaviour 2026-03-05 14:33:14 +00:00
Re-bin
06fcd2cc3f fix(discord): correct group_policy default to mention and style cleanup 2026-03-05 14:33:14 +00:00
Re-bin
376b7d6d58 Merge remote-tracking branch 'origin/main' into pr-553 2026-03-05 14:28:50 +00:00
Re-bin
bc52ad3dad Merge pull request #1428: feat(custom-provider) session affinity header 2026-03-05 14:27:24 +00:00
Re-bin
fb77176cfd feat(custom-provider): keep instance-level session affinity header for cache locality 2026-03-05 14:25:46 +00:00
Re-bin
a3c68ef140 Merge branch 'main' into pr-1428 2026-03-05 14:12:37 +00:00
coldxiangyu
46192fbd2a fix(context): detect image MIME type from magic bytes instead of file extension
Feishu downloads images with incorrect extensions (e.g. .jpg for PNG files).
mimetypes.guess_type() relies on the file extension, causing a MIME mismatch
that Anthropic rejects with 'image was specified using image/jpeg but appears
to be image/png'.

Fix: read the first bytes of the image data and detect the real MIME type via
magic bytes (PNG: 0x89PNG, JPEG: 0xFFD8FF, GIF: GIF87a/GIF89a, WEBP: RIFF+WEBP).
Fall back to mimetypes.guess_type() only when magic bytes are inconclusive.
2026-03-05 20:29:10 +08:00
ouyangwulin
d720235061 Merge branch 'HKUDS:main' into coding-plan 2026-03-05 17:47:41 +08:00
Xubin Ren
7b676962ed Merge PR #1568: fix(feishu): isolate lark ws Client event loop from main asyncio loop
fix(feishu): isolate lark ws Client event loop from main asyncio loop
2026-03-05 17:38:57 +08:00
ouyangwulin
6770a6e7e9 supported aliyun coding plan. 2026-03-05 17:34:36 +08:00
coldxiangyu
97522bfa03 fix(feishu): isolate lark ws Client event loop from main asyncio loop
Commit 0209ad5 moved `import lark_oapi as lark` inside the start()
method (lazy import) to suppress DeprecationWarnings. This had an
unintended side effect: the import now happens after the main asyncio
loop is already running, so lark_oapi's module-level

    loop = asyncio.get_event_loop()

captures the running main loop. When the WebSocket thread then calls
loop.run_until_complete() inside Client.start(), Python raises:

    RuntimeError: This event loop is already running

and the _connect/_disconnect coroutines are never awaited.

Fix: in run_ws(), create a fresh event loop with asyncio.new_event_loop(),
set it as the thread's current loop, and patch lark_oapi.ws.client.loop
to point to this dedicated loop before calling Client.start(). The loop
is closed on thread exit.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-03-05 17:27:17 +08:00
suger-m
323e5f22cc refactor(channels): extract split_message utility to reduce code duplication
Extract the _split_message function from discord.py and telegram.py
into a shared utility function in utils/helpers.py.

Changes:
- Add split_message() to nanobot/utils/helpers.py with configurable max_len
- Update Discord channel to use shared utility (2000 char limit)
- Update Telegram channel to use shared utility (4000 char limit)
- Remove duplicate implementations from both channels

Benefits:
- Reduces code duplication
- Centralizes message splitting logic for easier maintenance
- Makes the function reusable for future channels

The function splits content into chunks within max_len, preferring
to break at newlines or spaces rather than mid-word.
2026-03-05 17:16:47 +08:00
Barry Wang
667613d594 fix edge case casting and more test cases 2026-03-05 16:57:39 +08:00
Barry Wang
9e42ccb51e feat: auto casting tool params to match schema type 2026-03-05 16:57:39 +08:00
ouyangwulin
cf3e7e3f38 feat: Add Alibaba Cloud Coding Plan API support
Add dashscope_coding_plan provider to registry with OpenAI-compatible
endpoint for BaiLian coding assistance.

- Supports API key detection by 'sk-sp-' prefix pattern
- Adds provider config schema entry for proper loading
- Updates documentation with configuration instructions
- Fixes duplicate MatrixConfig class issue in schema
- Follow existing nanobot provider patterns for consistency
2026-03-05 16:54:15 +08:00
Peixian Gong
5cc3c03245 fix: merge tool_calls from multiple choices in LiteLLM response
GitHub Copilot's API returns tool_calls split across multiple choices:
- choices[0]: content only (tool_calls=null)
- choices[1]: tool_calls only (content=null)

The existing _parse_response only inspected choices[0], so tool_calls
were silently lost, causing the agent to never execute tools when using
github_copilot/ models.

This fix scans all choices and merges tool_calls + content, so
providers that return multi-choice responses work correctly.
Single-choice providers (OpenAI, Anthropic, etc.) are unaffected since
the loop over one choice is equivalent to the original code.
2026-03-05 15:15:37 +08:00
hcanyz
a08aae93e6 fix: not imported when LiteLLMProvider is not used
LiteLLM:WARNING: get_model_cost_map.py:213 - LiteLLM: Failed to fetch remote model cost map from https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json: The read operation timed out. Falling back to local backup.
2026-03-05 11:33:24 +08:00
Xubin Ren
fb74281434 Merge PR #1499: fix(qq): add msg_seq to prevent message deduplication error
fix(qq): add msg_seq to prevent message deduplication error
2026-03-05 10:39:45 +08:00
Xubin Ren
2484dc5ea6 Merge PR #1533: fix(tests): resolve failing tests
fix(tests): resolve failing tests
2026-03-05 10:28:39 +08:00
Sergio Sánchez Vallés
33f59d8a37 fix(agent): separate reasoning and tool hints to respect channel config 2026-03-05 00:45:15 +01:00
Sergio Sánchez Vallés
c27d2b1522 fix(agent): prevent tool hints from overwriting reasoning in streaming drafts 2026-03-05 00:33:27 +01:00
Sergio Sánchez Vallés
d019ff06d2 Merge branch 'main' into fix/test-failures 2026-03-04 20:07:58 +01:00
Sergio Sánchez Vallés
e032faaeff Merge branch 'main' of upstream/main into fix/test-failures 2026-03-04 20:04:00 +01:00
Sergio Sánchez Vallés
0209ad57d9 fix(tests): resolve RequestsDependencyWarning and lark-oapi asyncio/websockets DeprecationWarnings 2026-03-04 19:31:39 +01:00
Xubin Ren
4e9f08cafa Merge PR #1511: fix: add size limit to ReadFileTool to prevent OOM
fix: add size limit to ReadFileTool to prevent OOM
2026-03-05 01:12:40 +08:00
Xubin Ren
fd3b4389d2 Merge PR #1531: fix(feishu): convert audio type to file for API compatibility
fix(feishu): convert audio type to file for API compatibility
2026-03-05 00:38:15 +08:00
Xubin Ren
a156a8ee93 Merge PR #1507: fix: guard validate_params against non-dict input
fix: guard validate_params against non-dict input
2026-03-05 00:36:29 +08:00
Xubin Ren
d9ce3942fa Merge PR #1508: fix: handle invalid ISO datetime in CronTool gracefully
fix: handle invalid ISO datetime in CronTool gracefully
2026-03-05 00:35:16 +08:00
Xubin Ren
522cf89d53 Merge PR #1521: test: fix test failures from refactored cron and context builder
test: fix test failures from refactored cron and context builder
2026-03-05 00:34:01 +08:00
Xubin Ren
a2762351b3 Merge PR #1525: fix(codex): pass reasoning_effort to Codex API
fix(codex): pass reasoning_effort to Codex API
2026-03-05 00:31:09 +08:00
Ben
bdfe7d6449 fix(feishu): convert audio type to file for API compatibility
Feishu's GetMessageResource API only accepts 'image' or 'file' as the
type parameter. When downloading voice messages, nanobot was passing
'audio' which caused the API to reject the request with an error.

This fix converts 'audio' to 'file' in _download_file_sync method
before making the API call, allowing voice messages to be downloaded
and transcribed successfully.

Fixes voice message download failure in Feishu channel.
2026-03-05 00:16:31 +08:00