feat(chat,proxy): add @schedule mentions and localize proxy/schedule errors

- Support @schedule mentions in DB search, server mention resolution, and frontend mention parsing/i18n.
- Return structured product error codes for proxy route validation and localize them in proxy/schedule UI.
- Preserve unchanged proxy routes when rescheduling an existing schedule whose pool has no active nodes.
This commit is contained in:
ji ruo committed 2026-12-03 14:15:52 +08:00
1 parent 8568c41528
commit e6241dda09
15 files changed
+312 -49

No files matched your search

+16 -1
View File
@@ -34,7 +34,7 @@ type chatMentionCursor struct {
func ValidChatMentionKind(kind string) bool {
switch kind {
case "task", "finding", "company", "asset", "endpoint", "ip", "app", "root_domain", "subdomain", "service":
case "task", "schedule", "finding", "company", "asset", "endpoint", "ip", "app", "root_domain", "subdomain", "service":
return true
}
return false
@@ -76,6 +76,21 @@ SELECT kind, id, left(label, 160), left(description, 240) FROM (
AND ($4::bigint=0 OR (id::text=$2)<$6 OR ((id::text=$2)=$6 AND (id<$4 OR (id=$4 AND 'task'>$5))))
ORDER BY (id::text=$2) DESC, id DESC LIMIT 21)
UNION ALL
(SELECT 'schedule' AS kind, id,
COALESCE(NULLIF(name,''), '计划任务 #'||id::text) AS label,
concat_ws(' · ',
status,
CASE WHEN schedule_type='once'
THEN concat_ws(' ~ ', to_char(run_date,'YYYY-MM-DD'), to_char(end_date,'YYYY-MM-DD'))
ELSE 'weekly:'||weekdays END,
to_char(start_time,'HH24:MI') || CASE WHEN end_time IS NOT NULL THEN '-'||to_char(end_time,'HH24:MI') ELSE '+' END,
NULLIF(left(remark, 120), '')
) AS description
FROM task_schedules WHERE ($1='' OR $1='schedule') AND
($2='' OR id::text=$2 OR concat_ws(' ', name, remark, schedule_type, status) ILIKE $3)
AND ($4::bigint=0 OR (id::text=$2)<$6 OR ((id::text=$2)=$6 AND (id<$4 OR (id=$4 AND 'schedule'>$5))))
ORDER BY (id::text=$2) DESC, id DESC LIMIT 21)
UNION ALL
(SELECT 'finding' AS kind, id, COALESCE(NULLIF(name,''), vulnclass) AS label,
concat_ws(' · ', severity, status, left(summary, 160)) AS description
FROM findings WHERE ($1='' OR $1='finding') AND