@lobehub/lobehub 2.0.0-next.276 → 2.0.0-next.278

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/.cursor/rules/db-migrations.mdc +1 -1
  2. package/.cursor/rules/debug-usage.mdc +7 -5
  3. package/.cursor/rules/desktop-controller-tests.mdc +2 -1
  4. package/.cursor/rules/desktop-feature-implementation.mdc +9 -5
  5. package/.cursor/rules/desktop-local-tools-implement.mdc +67 -66
  6. package/.cursor/rules/desktop-menu-configuration.mdc +21 -9
  7. package/.cursor/rules/desktop-window-management.mdc +17 -2
  8. package/.cursor/rules/drizzle-schema-style-guide.mdc +6 -6
  9. package/.cursor/rules/hotkey.mdc +1 -0
  10. package/.cursor/rules/i18n.mdc +1 -0
  11. package/.cursor/rules/project-structure.mdc +16 -3
  12. package/.cursor/rules/react.mdc +17 -5
  13. package/.cursor/rules/recent-data-usage.mdc +2 -1
  14. package/.cursor/rules/testing-guide/testing-guide.mdc +262 -238
  15. package/.cursor/rules/testing-guide/zustand-store-action-test.mdc +1 -1
  16. package/.cursor/rules/zustand-action-patterns.mdc +1 -1
  17. package/.cursor/rules/zustand-slice-organization.mdc +4 -4
  18. package/CHANGELOG.md +51 -0
  19. package/CLAUDE.md +1 -1
  20. package/GEMINI.md +1 -1
  21. package/changelog/v1.json +14 -0
  22. package/docs/development/database-schema.dbml +16 -0
  23. package/locales/en-US/chat.json +24 -0
  24. package/locales/en-US/setting.json +11 -0
  25. package/locales/zh-CN/chat.json +24 -0
  26. package/locales/zh-CN/setting.json +11 -0
  27. package/package.json +1 -1
  28. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/BatchCreateAgents/index.tsx +2 -2
  29. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/UpdateGroup/index.tsx +56 -56
  30. package/packages/builtin-tool-group-agent-builder/src/client/Render/BatchCreateAgents.tsx +3 -2
  31. package/packages/builtin-tool-group-agent-builder/src/executor.ts +2 -1
  32. package/packages/business/const/src/index.ts +3 -0
  33. package/packages/database/migrations/0069_add_topic_shares_table.sql +22 -0
  34. package/packages/database/migrations/meta/0069_snapshot.json +9704 -0
  35. package/packages/database/migrations/meta/_journal.json +7 -0
  36. package/packages/database/src/models/__tests__/topicShare.test.ts +318 -0
  37. package/packages/database/src/models/topicShare.ts +177 -0
  38. package/packages/database/src/schemas/topic.ts +44 -2
  39. package/packages/types/src/agentCronJob/index.ts +19 -23
  40. package/packages/types/src/conversation.ts +5 -0
  41. package/packages/types/src/serverConfig.ts +1 -0
  42. package/packages/types/src/topic/topic.ts +46 -0
  43. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Cron/Actions.tsx +31 -0
  44. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Cron/CronTopicGroup.tsx +10 -6
  45. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Cron/index.tsx +7 -11
  46. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Cron/useDropdownMenu.tsx +102 -0
  47. package/src/app/[variants]/(main)/agent/cron/[cronId]/CronConfig.ts +179 -0
  48. package/src/app/[variants]/(main)/agent/cron/[cronId]/features/CronJobContentEditor.tsx +111 -0
  49. package/src/app/[variants]/(main)/agent/cron/[cronId]/features/CronJobHeader.tsx +45 -0
  50. package/src/app/[variants]/(main)/agent/cron/[cronId]/features/CronJobSaveButton.tsx +31 -0
  51. package/src/app/[variants]/(main)/agent/cron/[cronId]/features/CronJobScheduleConfig.tsx +213 -0
  52. package/src/app/[variants]/(main)/agent/cron/[cronId]/index.tsx +186 -344
  53. package/src/app/[variants]/(main)/agent/features/Conversation/Header/ShareButton/index.tsx +24 -9
  54. package/src/app/[variants]/(main)/agent/profile/features/AgentCronJobs/index.tsx +42 -97
  55. package/src/app/[variants]/(main)/agent/profile/features/ProfileEditor/index.tsx +4 -20
  56. package/src/app/[variants]/(main)/community/features/UserAvatar/index.tsx +15 -5
  57. package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/AgentProfilePopup.tsx +1 -6
  58. package/src/app/[variants]/(main)/group/features/Conversation/Header/ShareButton/index.tsx +26 -9
  59. package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/AspectRatioSelect/index.tsx +1 -2
  60. package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/ImageNum.tsx +54 -173
  61. package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/ResolutionSelect.tsx +22 -67
  62. package/src/app/[variants]/(mobile)/router/mobileRouter.config.tsx +18 -0
  63. package/src/app/[variants]/router/desktopRouter.config.tsx +18 -0
  64. package/src/app/[variants]/share/t/[id]/SharedMessageList.tsx +54 -0
  65. package/src/app/[variants]/share/t/[id]/_layout/index.tsx +170 -0
  66. package/src/app/[variants]/share/t/[id]/features/Portal/index.tsx +66 -0
  67. package/src/app/[variants]/share/t/[id]/index.tsx +112 -0
  68. package/src/app/robots.tsx +1 -1
  69. package/src/business/client/BusinessMobileRoutes.tsx +1 -1
  70. package/src/features/Conversation/ChatList/index.tsx +12 -5
  71. package/src/features/Conversation/Messages/AssistantGroup/Tool/Render/index.tsx +8 -4
  72. package/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx +15 -10
  73. package/src/features/Conversation/Messages/AssistantGroup/Tools.tsx +3 -1
  74. package/src/features/Conversation/Messages/AssistantGroup/components/ContentBlock.tsx +3 -2
  75. package/src/features/Conversation/Messages/AssistantGroup/components/GroupItem.tsx +2 -2
  76. package/src/features/Conversation/Messages/Supervisor/components/ContentBlock.tsx +25 -26
  77. package/src/features/Conversation/Messages/Supervisor/components/Group.tsx +4 -2
  78. package/src/features/Conversation/Messages/Tool/Tool/index.tsx +16 -12
  79. package/src/features/Conversation/Messages/Tool/index.tsx +20 -11
  80. package/src/features/Conversation/Messages/index.tsx +1 -1
  81. package/src/features/Conversation/store/slices/data/action.ts +2 -1
  82. package/src/features/SharePopover/index.tsx +215 -0
  83. package/src/features/SharePopover/style.ts +10 -0
  84. package/src/libs/next/proxy/define-config.ts +4 -1
  85. package/src/locales/default/chat.ts +26 -0
  86. package/src/proxy.ts +1 -0
  87. package/src/server/globalConfig/index.ts +1 -0
  88. package/src/server/routers/lambda/__tests__/message.test.ts +152 -0
  89. package/src/server/routers/lambda/__tests__/share.test.ts +227 -0
  90. package/src/server/routers/lambda/__tests__/topic.test.ts +174 -0
  91. package/src/server/routers/lambda/index.ts +2 -0
  92. package/src/server/routers/lambda/message.ts +37 -4
  93. package/src/server/routers/lambda/share.ts +55 -0
  94. package/src/server/routers/lambda/topic.ts +45 -0
  95. package/src/services/chatGroup/index.ts +1 -4
  96. package/src/services/message/index.ts +1 -0
  97. package/src/services/topic/index.ts +16 -0
  98. package/src/store/serverConfig/selectors.ts +1 -0
@@ -0,0 +1,213 @@
1
+ import { Flexbox, Tag, Text } from '@lobehub/ui';
2
+ import { Card, InputNumber, Select, TimePicker } from 'antd';
3
+ import type { Dayjs } from 'dayjs';
4
+ import dayjs from 'dayjs';
5
+ import { memo, useMemo } from 'react';
6
+ import { useTranslation } from 'react-i18next';
7
+
8
+ import {
9
+ SCHEDULE_TYPE_OPTIONS,
10
+ type ScheduleType,
11
+ TIMEZONE_OPTIONS,
12
+ WEEKDAY_LABELS,
13
+ WEEKDAY_OPTIONS,
14
+ } from '../CronConfig';
15
+
16
+ interface CronJobScheduleConfigProps {
17
+ hourlyInterval?: number;
18
+ maxExecutions?: number | null;
19
+ onScheduleChange: (updates: {
20
+ hourlyInterval?: number;
21
+ maxExecutions?: number | null;
22
+ scheduleType?: ScheduleType;
23
+ timezone?: string;
24
+ triggerTime?: Dayjs;
25
+ weekdays?: number[];
26
+ }) => void;
27
+ scheduleType: ScheduleType;
28
+ timezone: string;
29
+ triggerTime: Dayjs;
30
+ weekdays: number[];
31
+ }
32
+
33
+ const CronJobScheduleConfig = memo<CronJobScheduleConfigProps>(
34
+ ({
35
+ hourlyInterval,
36
+ maxExecutions,
37
+ onScheduleChange,
38
+ scheduleType,
39
+ timezone,
40
+ triggerTime,
41
+ weekdays,
42
+ }) => {
43
+ const { t } = useTranslation('setting');
44
+
45
+ // Compute summary tags
46
+ const summaryTags = useMemo(() => {
47
+ const result: Array<{ key: string; label: string }> = [];
48
+
49
+ // Schedule type
50
+ const scheduleTypeLabel = SCHEDULE_TYPE_OPTIONS.find(
51
+ (opt) => opt.value === scheduleType,
52
+ )?.label;
53
+ if (scheduleTypeLabel) {
54
+ result.push({
55
+ key: 'scheduleType',
56
+ label: t(scheduleTypeLabel as any),
57
+ });
58
+ }
59
+
60
+ // Trigger time
61
+ if (scheduleType === 'hourly') {
62
+ const minute = triggerTime.minute();
63
+ result.push({
64
+ key: 'interval',
65
+ label: `Every ${hourlyInterval || 1} hour(s) at :${minute.toString().padStart(2, '0')}`,
66
+ });
67
+ } else {
68
+ result.push({
69
+ key: 'triggerTime',
70
+ label: triggerTime.format('HH:mm'),
71
+ });
72
+ }
73
+
74
+ // Timezone
75
+ result.push({
76
+ key: 'timezone',
77
+ label: timezone,
78
+ });
79
+
80
+ // Weekdays for weekly schedule
81
+ if (scheduleType === 'weekly' && weekdays.length > 0) {
82
+ result.push({
83
+ key: 'weekdays',
84
+ label: weekdays.map((day) => WEEKDAY_LABELS[day]).join(', '),
85
+ });
86
+ }
87
+
88
+ return result;
89
+ }, [scheduleType, triggerTime, timezone, weekdays, hourlyInterval, t]);
90
+
91
+ return (
92
+ <Card size="small" style={{ borderRadius: 12 }} styles={{ body: { padding: 12 } }}>
93
+ <Flexbox gap={12}>
94
+ {/* Summary Tags */}
95
+ {summaryTags.length > 0 && (
96
+ <Flexbox align="center" gap={8} horizontal style={{ flexWrap: 'wrap' }}>
97
+ {summaryTags.map((tag) => (
98
+ <Tag key={tag.key} variant={'filled'}>
99
+ {tag.label}
100
+ </Tag>
101
+ ))}
102
+ </Flexbox>
103
+ )}
104
+ {/* Schedule Configuration - All in one row */}
105
+ <Flexbox align="center" gap={8} horizontal style={{ flexWrap: 'wrap' }}>
106
+ <Tag variant={'borderless'}>{t('agentCronJobs.schedule')}</Tag>
107
+ <Select
108
+ onChange={(value: ScheduleType) =>
109
+ onScheduleChange({
110
+ scheduleType: value,
111
+ weekdays: value === 'weekly' ? [0, 1, 2, 3, 4, 5, 6] : [],
112
+ })
113
+ }
114
+ options={SCHEDULE_TYPE_OPTIONS.map((opt) => ({
115
+ label: t(opt.label as any),
116
+ value: opt.value,
117
+ }))}
118
+ size="small"
119
+ style={{ minWidth: 120 }}
120
+ value={scheduleType}
121
+ />
122
+
123
+ {/* Weekdays - show only for weekly */}
124
+ {scheduleType === 'weekly' && (
125
+ <Select
126
+ maxTagCount="responsive"
127
+ mode="multiple"
128
+ onChange={(values: number[]) => onScheduleChange({ weekdays: values })}
129
+ options={WEEKDAY_OPTIONS}
130
+ placeholder="Select days"
131
+ size="small"
132
+ style={{ minWidth: 150 }}
133
+ value={weekdays}
134
+ />
135
+ )}
136
+
137
+ {/* Trigger Time - show for daily and weekly */}
138
+ {scheduleType !== 'hourly' && (
139
+ <TimePicker
140
+ format="HH:mm"
141
+ minuteStep={30}
142
+ onChange={(value) => {
143
+ if (value) onScheduleChange({ triggerTime: value });
144
+ }}
145
+ size="small"
146
+ style={{ minWidth: 120 }}
147
+ value={triggerTime ?? dayjs().hour(0).minute(0)}
148
+ />
149
+ )}
150
+
151
+ {/* Hourly Interval - show only for hourly */}
152
+ {scheduleType === 'hourly' && (
153
+ <>
154
+ <Tag variant={'borderless'}>Every</Tag>
155
+ <InputNumber
156
+ max={24}
157
+ min={1}
158
+ onChange={(value: number | null) =>
159
+ onScheduleChange({ hourlyInterval: value ?? 1 })
160
+ }
161
+ size="small"
162
+ style={{ width: 80 }}
163
+ value={hourlyInterval ?? 1}
164
+ />
165
+ <Text type="secondary">hour(s) at</Text>
166
+ <Select
167
+ onChange={(value: number) =>
168
+ onScheduleChange({ triggerTime: dayjs().hour(0).minute(value) })
169
+ }
170
+ options={[
171
+ { label: ':00', value: 0 },
172
+ { label: ':30', value: 30 },
173
+ ]}
174
+ size="small"
175
+ style={{ width: 80 }}
176
+ value={triggerTime?.minute() ?? 0}
177
+ />
178
+ </>
179
+ )}
180
+
181
+ {/* Timezone */}
182
+ <Select
183
+ onChange={(value: string) => onScheduleChange({ timezone: value })}
184
+ options={TIMEZONE_OPTIONS}
185
+ showSearch
186
+ size="small"
187
+ style={{ maxWidth: 300, minWidth: 200 }}
188
+ value={timezone}
189
+ />
190
+
191
+ </Flexbox>
192
+
193
+ {/* Max Executions */}
194
+ <Flexbox align="center" gap={8} horizontal style={{ flexWrap: 'wrap' }}>
195
+ <Tag variant={'borderless'}>{t('agentCronJobs.maxExecutions')}</Tag>
196
+ <InputNumber
197
+ min={1}
198
+ onChange={(value: number | null) =>
199
+ onScheduleChange({ maxExecutions: value ?? null })
200
+ }
201
+ placeholder={t('agentCronJobs.form.maxExecutions.placeholder')}
202
+ size="small"
203
+ style={{ width: 160 }}
204
+ value={maxExecutions ?? null}
205
+ />
206
+ </Flexbox>
207
+ </Flexbox>
208
+ </Card>
209
+ );
210
+ },
211
+ );
212
+
213
+ export default CronJobScheduleConfig;