mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-15 08:17:09 +00:00
fix: feishu reply context truncation + task events NULL data crash (#508)
* fix(feishu): increase reply context max length from 500 to 2000
500 bytes is too short for CJK/Unicode text (each accented char = 2-3
bytes, so ~250 real characters). Increase to 2000 so reply context is
not aggressively truncated.
* fix(teams): handle NULL data column in task events queries
ListTaskEvents and ListTeamEvents crash with "unsupported Scan,
storing driver.Value type <nil> into type *json.RawMessage" when the
data column is NULL. Use COALESCE(data, '{}') to return an empty JSON
object instead.
---------
Co-authored-by: Luvu182 <208665161+Luvu182@users.noreply.github.com>
This commit is contained in:
1 parent
1efec43df0
commit
9e74974129
2 files changed
+3
-3
No files matched your search
@@ -277,7 +277,7 @@ func (c *Channel) handleMessageEvent(ctx context.Context, event *MessageEvent) {
|
||||
}
|
||||
}
|
||||
|
||||
const replyContextMaxLen = 500
|
||||
const replyContextMaxLen = 2000
|
||||
|
||||
// fetchReplyContext fetches the parent message content and returns a formatted
|
||||
// reply context string + any downloaded media from the parent message.
|
||||
|
||||
@@ -132,7 +132,7 @@ func (s *PGTeamStore) RecordTaskEvent(ctx context.Context, event *store.TeamTask
|
||||
func (s *PGTeamStore) ListTaskEvents(ctx context.Context, taskID uuid.UUID) ([]store.TeamTaskEventData, error) {
|
||||
tid := tenantIDForInsert(ctx)
|
||||
rows, err := s.db.QueryContext(ctx,
|
||||
`SELECT id, task_id, event_type, actor_type, actor_id, data, created_at
|
||||
`SELECT id, task_id, event_type, actor_type, actor_id, COALESCE(data, '{}'), created_at
|
||||
FROM team_task_events
|
||||
WHERE task_id = $1 AND tenant_id = $2
|
||||
ORDER BY created_at ASC`, taskID, tid)
|
||||
@@ -160,7 +160,7 @@ func (s *PGTeamStore) ListTeamEvents(ctx context.Context, teamID uuid.UUID, limi
|
||||
}
|
||||
tid := tenantIDForInsert(ctx)
|
||||
rows, err := s.db.QueryContext(ctx,
|
||||
`SELECT e.id, e.task_id, e.event_type, e.actor_type, e.actor_id, e.data, e.created_at
|
||||
`SELECT e.id, e.task_id, e.event_type, e.actor_type, e.actor_id, COALESCE(e.data, '{}'), e.created_at
|
||||
FROM team_task_events e
|
||||
JOIN team_tasks t ON t.id = e.task_id
|
||||
WHERE t.team_id = $1 AND t.tenant_id = $4
|
||||
|
||||
Reference in new issue
Block a user