@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.
- package/.cursor/rules/db-migrations.mdc +1 -1
- package/.cursor/rules/debug-usage.mdc +7 -5
- package/.cursor/rules/desktop-controller-tests.mdc +2 -1
- package/.cursor/rules/desktop-feature-implementation.mdc +9 -5
- package/.cursor/rules/desktop-local-tools-implement.mdc +67 -66
- package/.cursor/rules/desktop-menu-configuration.mdc +21 -9
- package/.cursor/rules/desktop-window-management.mdc +17 -2
- package/.cursor/rules/drizzle-schema-style-guide.mdc +6 -6
- package/.cursor/rules/hotkey.mdc +1 -0
- package/.cursor/rules/i18n.mdc +1 -0
- package/.cursor/rules/project-structure.mdc +16 -3
- package/.cursor/rules/react.mdc +17 -5
- package/.cursor/rules/recent-data-usage.mdc +2 -1
- package/.cursor/rules/testing-guide/testing-guide.mdc +262 -238
- package/.cursor/rules/testing-guide/zustand-store-action-test.mdc +1 -1
- package/.cursor/rules/zustand-action-patterns.mdc +1 -1
- package/.cursor/rules/zustand-slice-organization.mdc +4 -4
- package/CHANGELOG.md +51 -0
- package/CLAUDE.md +1 -1
- package/GEMINI.md +1 -1
- package/changelog/v1.json +14 -0
- package/docs/development/database-schema.dbml +16 -0
- package/locales/en-US/chat.json +24 -0
- package/locales/en-US/setting.json +11 -0
- package/locales/zh-CN/chat.json +24 -0
- package/locales/zh-CN/setting.json +11 -0
- package/package.json +1 -1
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/BatchCreateAgents/index.tsx +2 -2
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/UpdateGroup/index.tsx +56 -56
- package/packages/builtin-tool-group-agent-builder/src/client/Render/BatchCreateAgents.tsx +3 -2
- package/packages/builtin-tool-group-agent-builder/src/executor.ts +2 -1
- package/packages/business/const/src/index.ts +3 -0
- package/packages/database/migrations/0069_add_topic_shares_table.sql +22 -0
- package/packages/database/migrations/meta/0069_snapshot.json +9704 -0
- package/packages/database/migrations/meta/_journal.json +7 -0
- package/packages/database/src/models/__tests__/topicShare.test.ts +318 -0
- package/packages/database/src/models/topicShare.ts +177 -0
- package/packages/database/src/schemas/topic.ts +44 -2
- package/packages/types/src/agentCronJob/index.ts +19 -23
- package/packages/types/src/conversation.ts +5 -0
- package/packages/types/src/serverConfig.ts +1 -0
- package/packages/types/src/topic/topic.ts +46 -0
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Cron/Actions.tsx +31 -0
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Cron/CronTopicGroup.tsx +10 -6
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Cron/index.tsx +7 -11
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Cron/useDropdownMenu.tsx +102 -0
- package/src/app/[variants]/(main)/agent/cron/[cronId]/CronConfig.ts +179 -0
- package/src/app/[variants]/(main)/agent/cron/[cronId]/features/CronJobContentEditor.tsx +111 -0
- package/src/app/[variants]/(main)/agent/cron/[cronId]/features/CronJobHeader.tsx +45 -0
- package/src/app/[variants]/(main)/agent/cron/[cronId]/features/CronJobSaveButton.tsx +31 -0
- package/src/app/[variants]/(main)/agent/cron/[cronId]/features/CronJobScheduleConfig.tsx +213 -0
- package/src/app/[variants]/(main)/agent/cron/[cronId]/index.tsx +186 -344
- package/src/app/[variants]/(main)/agent/features/Conversation/Header/ShareButton/index.tsx +24 -9
- package/src/app/[variants]/(main)/agent/profile/features/AgentCronJobs/index.tsx +42 -97
- package/src/app/[variants]/(main)/agent/profile/features/ProfileEditor/index.tsx +4 -20
- package/src/app/[variants]/(main)/community/features/UserAvatar/index.tsx +15 -5
- package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/AgentProfilePopup.tsx +1 -6
- package/src/app/[variants]/(main)/group/features/Conversation/Header/ShareButton/index.tsx +26 -9
- package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/AspectRatioSelect/index.tsx +1 -2
- package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/ImageNum.tsx +54 -173
- package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/ResolutionSelect.tsx +22 -67
- package/src/app/[variants]/(mobile)/router/mobileRouter.config.tsx +18 -0
- package/src/app/[variants]/router/desktopRouter.config.tsx +18 -0
- package/src/app/[variants]/share/t/[id]/SharedMessageList.tsx +54 -0
- package/src/app/[variants]/share/t/[id]/_layout/index.tsx +170 -0
- package/src/app/[variants]/share/t/[id]/features/Portal/index.tsx +66 -0
- package/src/app/[variants]/share/t/[id]/index.tsx +112 -0
- package/src/app/robots.tsx +1 -1
- package/src/business/client/BusinessMobileRoutes.tsx +1 -1
- package/src/features/Conversation/ChatList/index.tsx +12 -5
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Render/index.tsx +8 -4
- package/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx +15 -10
- package/src/features/Conversation/Messages/AssistantGroup/Tools.tsx +3 -1
- package/src/features/Conversation/Messages/AssistantGroup/components/ContentBlock.tsx +3 -2
- package/src/features/Conversation/Messages/AssistantGroup/components/GroupItem.tsx +2 -2
- package/src/features/Conversation/Messages/Supervisor/components/ContentBlock.tsx +25 -26
- package/src/features/Conversation/Messages/Supervisor/components/Group.tsx +4 -2
- package/src/features/Conversation/Messages/Tool/Tool/index.tsx +16 -12
- package/src/features/Conversation/Messages/Tool/index.tsx +20 -11
- package/src/features/Conversation/Messages/index.tsx +1 -1
- package/src/features/Conversation/store/slices/data/action.ts +2 -1
- package/src/features/SharePopover/index.tsx +215 -0
- package/src/features/SharePopover/style.ts +10 -0
- package/src/libs/next/proxy/define-config.ts +4 -1
- package/src/locales/default/chat.ts +26 -0
- package/src/proxy.ts +1 -0
- package/src/server/globalConfig/index.ts +1 -0
- package/src/server/routers/lambda/__tests__/message.test.ts +152 -0
- package/src/server/routers/lambda/__tests__/share.test.ts +227 -0
- package/src/server/routers/lambda/__tests__/topic.test.ts +174 -0
- package/src/server/routers/lambda/index.ts +2 -0
- package/src/server/routers/lambda/message.ts +37 -4
- package/src/server/routers/lambda/share.ts +55 -0
- package/src/server/routers/lambda/topic.ts +45 -0
- package/src/services/chatGroup/index.ts +1 -4
- package/src/services/message/index.ts +1 -0
- package/src/services/topic/index.ts +16 -0
- 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;
|