82 Commits

Author SHA1 Message Date
cfc61c52ba Re-attach timestamp on continuation lines after a time gap
Consecutive messages from the same sender are collapsed under one
name+time header to save context, with follow-ups rendered as bare
"└" continuation lines. When a sender resumed minutes later, the
follow-up still inherited the original timestamp, so the model judged a
just-sent message as having happened long ago and skipped replying.

Track the previous record time and re-print the timestamp on a
continuation line once the gap exceeds CONTINUATION_TIME_GAP_SECONDS
(60s). Short bursts stay timeless to keep context lean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 20:24:21 +08:00
ebb1fbe10c Guard group active-level fetch in name card serialization
member.active.temperature relies on OneBot pulling group honor data,
which throws "Error code: 2" when the upstream is busy/unavailable. That
access sat outside the existing title try/catch, so a failure propagated
through getSystemPrompt -> onMessage and aborted the entire reply.

Wrap the active.temperature access in its own try/catch and degrade
gracefully (omit the lv segment) instead of breaking the whole turn.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 20:15:34 +08:00
a29cf17361 Release ByteReadChannel when first-chunk timeout fires
The streaming refactor moved post()+body() inside withTimeout, so a
first-chunk timeout threw before `channel` was bound and the finally
guard never ran, leaking the connection on every slow-API retry. Hold
the channel in an outer nullable var and wrap the whole flow in
try/finally so an acquired channel is always cancelled.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 23:56:11 +08:00
4307019ee8 Add global skill system for self-accumulated knowledge
Introduce a cross-group skill system that lets the bot distill reusable
knowledge into markdown docs and load them on demand, keeping day-to-day
context pollution low.

- SkillStore manages data/skills/*.md files with name/description
  frontmatter and an in-memory index cache (rebuilt on init/reload)
- Only the skill index (name + one-line description) is injected via the
  new {skills} system-prompt placeholder; bodies load on demand
- New tools: loadSkill / saveSkill (upsert, iterate = load+overwrite) /
  deleteSkill, gated by PluginConfig.skillsEnabled
- Skill names validated against ^[A-Za-z0-9_-]+$ to prevent traversal
- Wire SkillStore.init into onEnable and refresh on /jgpt reload; add
  /jgpt skills listing command
- Bump version to 1.12.0; update README

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 23:37:44 +08:00
538fe563a0 Expand forwarded messages into context with nested support
Forwarded messages were collapsed to a placeholder, so the LLM couldn't
read a forwarded conversation a user asked it to look at. Now forwards
are fully expanded (no truncation, relying on the large context window
and cache hits) as Markdown blockquotes, with each nesting level adding
another ">". Nested forwards recurse by depth for clean, unambiguous
indentation; node bodies (including images) render inline.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 23:03:26 +08:00
890ccb10d5 Separate real group role from title in serialized name card
A custom special title (e.g. a troll "群主" given to a regular member)
used to override the permission-based role, misleading the LLM about
who actually holds authority. Now the real role (群主/管理员/群员) from
member.permission is always shown, with the title slot showing the
special title (labeled 头衔"…") when present, otherwise falling back to
the activity-level temperatureTitle that everyone sees in chat.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 22:57:52 +08:00
d2bdd273b2 Add reply-to-message capability with ID-addressable history
Lets the bot quote-reply to a specific message via an optional replyTo
on sendSingleMessage, and reworks history serialization so the LLM can
address messages and stop confusing quoted content with the quoter.

- Serialize each history line with a short [n] id; consecutive messages
  from the same sender continue under "[n]  └". A per-subject ReplyIndex
  maps [n] -> MessageRecord, kept alive with the context cache so ids
  stay continuous across cached turns.
- Replace inlined quote text with a reference: "↩[k]" when the quoted
  message is in-window, otherwise "↩(author:"snippet…")". This removes
  the ambiguity where A quoting B looked like A's own speech.
- Collapse forwarded messages to "[转发消息·N条:title]".
- sendSingleMessage accepts replyTo (the [n]); it resolves the record via
  MessageRecord.toMessageSource() and prepends a QuoteReply, falling back
  to a plain send with a note if the source is gone. ids may be null, so
  numbering still happens but such records can't be reply targets.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 22:46:59 +08:00
eedbd55f62 Fix streaming first-token timeout never firing on slow API
The firstChunkTimeout only wrapped the response-body read, but when the
upstream (e.g. DeepSeek under load) stalls before sending response
headers, httpClient.post() itself blocks and the withTimeout block is
never reached. Every slow request fell through to Ktor's
requestTimeoutMillis (120s) and was retried up to retryMax times,
causing multi-minute waits before any reply.

- Move post() inside withTimeout(firstChunkTimeout) so the entire
  request-to-first-data-chunk window is bounded and fails fast.
- Apply withTimeout(firstChunkTimeout) to each streaming read so a
  mid-stream stall is also caught quickly instead of waiting on the
  socket/request backstop.
- Drop requestTimeoutMillis so legitimately long streams are no longer
  killed at 120s; TTFT and inter-token gaps are now governed at the
  application layer.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 22:01:44 +08:00
92acbb2310 Upgrade TTS to qwen3-tts-instruct-flash with instruction control
Adds an optional instructions parameter to sendVoiceMessage so the model
can describe tone, pace and emotion in natural language. Defaults the
TTS model to qwen3-tts-instruct-flash; Chelsie voice is unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 15:57:15 +08:00
39b49bb302 Replace ImageEdit with ImageAgent for Qwen Image 2.0
Supports text-to-image, single-image edit and multi-image fusion (0-3
reference images) via a single tool. Renames imageEditModel config to
imageModel (default qwen-image-2.0) and adds imageWatermark toggle.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 15:47:08 +08:00
98bb1066c4 Update README 2026-05-22 14:16:18 +08:00
4dde523dfc Move token usage to JSON store 2026-05-22 14:16:12 +08:00
f17adee4ba Extend favorability into user profile system 2026-05-22 14:16:06 +08:00
72892336bc Add first-chunk timeout 2026-05-22 14:16:00 +08:00
e629d37fa8 Relax searchChatHistory limits 2026-05-22 14:15:54 +08:00
200a404927 Update README for v1.11.0 2026-05-22 14:15:48 +08:00
3ed54dae0e Update version to v1.11.0 2026-05-22 14:15:42 +08:00
417b5f631f Add searchChatHistory tool 2026-05-22 14:15:34 +08:00
bc2ab553b9 Add reasoning_content replay for tool calls 2026-05-22 14:15:19 +08:00
e5d5445a1f Add ModelService with extra body support 2026-05-22 14:15:12 +08:00
2d3045e110 Add tokens report command and optimize statistics queries
- Add /jgpt tokens [days] command for usage summary report
- Add /jgpt tokensUserDaily <userId> [days] for daily user stats
- Fix tokensDaily day calculation (was showing 4 days for 3-day query)
- Optimize tokens() from 5-6 passes to single pass (5-10x faster)
- Fix tokensUserDaily inefficient nickname lookup
- Add number formatting with thousand separators to all outputs
- Extract helper functions: calculateCutoffTimestamp, calculateTodayStartTimestamp
- Add parameter validation for days and limit
- Update README with new commands and formatted examples

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 12:36:11 +08:00
b0c985e220 Add token consumption tracking system Update version to v1.10.0 2026-03-18 12:09:23 +08:00
c4afdb811b Add Lunar calendar context 2026-01-26 17:42:46 +08:00
9094f6c8db Add maxToolOutputLength config 2026-01-25 12:59:00 +08:00
ec358fd852 Add context cache 2026-01-06 16:49:27 +08:00
6705859604 Add requestOwnerHelp tool 2025-12-06 00:24:24 +08:00
621a045a62 Update Jina to allow trial usage without a key 2025-12-02 23:52:34 +08:00
634f0c1026 Add meme prompt 2025-11-24 21:31:40 +08:00
0f482407d4 Add favorability system
Update version to v1.9.0
2025-10-30 15:03:38 +08:00
8ac0197fc4 Add memory clear command 2025-09-11 21:54:24 +08:00
68a45a9657 Update LeTeX return message 2025-09-11 21:47:48 +08:00
099625c2f2 Separate LaTeX parsing into independent tool for LLM calling 2025-09-11 19:15:33 +08:00
ffa7f78c25 Update README by Qwen 2025-09-10 11:12:30 +08:00
2c40ef1b16 Add Memory switch 2025-09-10 10:53:34 +08:00
e083b7aff9 Adjust the chat history concatenation format 2025-09-05 23:45:21 +08:00
e2caba6a10 Add reply message call 2025-08-31 21:04:57 +08:00
af17f1e698 Update version to 1.8.0
Add SendVoiceMessage tool
Move prompt to SystemPrompt.md file
Add tool calling message switch config
2025-08-31 15:57:16 +08:00
e79bcd9983 Update tool list
Disable EPIC Free game tool
Fix the issue where invalid JSON parameters caused exceptions
2025-08-21 13:57:03 +08:00
b6aa638b1a Add DashScope API Config 2025-08-21 13:55:21 +08:00
bc2eb437e6 Update VisualAgent tool name to imageRecognition 2025-08-21 13:55:08 +08:00
b534606bb0 Update runCode tool description 2025-08-21 13:54:46 +08:00
867d9ad56f Update http client timeout 2025-08-21 13:54:20 +08:00
92a6879cc1 Add imageEdit tool 2025-08-21 13:54:02 +08:00
eda932b4e9 Update memory structure 2025-07-20 11:27:31 +08:00
6cba3cca22 Shorten dialogue intervals 2025-07-20 11:27:11 +08:00
60a48c5211 Add data reload 2025-07-20 11:26:41 +08:00
dbfdf83dc6 Add image message 2025-07-20 11:12:26 +08:00
3a5caf86a1 Split memory agent 2025-07-20 11:11:47 +08:00
c479282fe4 Update to streaming processing response
Update regex
2025-07-20 00:45:59 +08:00
d1ee8f9fcf Update memory agent description 2025-07-17 13:07:21 +08:00