Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions hermes_cli/web_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -7046,6 +7046,7 @@ class CronJobCreate(BaseModel):
name: str = ""
deliver: str = "local"
skills: Optional[List[str]] = None
model: str = ""


class CronJobUpdate(BaseModel):
Expand Down Expand Up @@ -7218,6 +7219,7 @@ async def create_cron_job(body: CronJobCreate, profile: str = "default"):
name=body.name,
deliver=body.deliver,
skills=body.skills,
model=body.model,
)
except Exception as e:
_log.exception("POST /api/cron/jobs failed")
Expand Down
2 changes: 2 additions & 0 deletions web/src/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ export const en: Translations = {
newJob: "New Cron Job",
nameOptional: "Name (optional)",
namePlaceholder: "e.g. Daily summary",
modelOptional: "Model (optional)",
modelPlaceholder: "e.g. moonshotai/kimi-k2.6 (leaves the gateway default if empty)",
prompt: "Prompt",
promptPlaceholder: "What should the agent do on each run?",
schedule: "Schedule (cron expression)",
Expand Down
2 changes: 2 additions & 0 deletions web/src/i18n/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ export interface Translations {
newJob: string;
nameOptional: string;
namePlaceholder: string;
modelOptional?: string;
modelPlaceholder?: string;
prompt: string;
promptPlaceholder: string;
schedule: string;
Expand Down
5 changes: 3 additions & 2 deletions web/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ export const api = {
fetchJSON<CronJob[]>(`/api/cron/jobs?profile=${encodeURIComponent(profile)}`),
getCronDeliveryTargets: () =>
fetchJSON<{ targets: CronDeliveryTarget[] }>("/api/cron/delivery-targets"),
createCronJob: (job: { prompt: string; schedule: string; name?: string; deliver?: string; skills?: string[] }, profile = "default") =>
createCronJob: (job: { prompt: string; schedule: string; name?: string; deliver?: string; skills?: string[]; model?: string }, profile = "default") =>
fetchJSON<CronJob>(`/api/cron/jobs?profile=${encodeURIComponent(profile)}`, {
method: "POST",
headers: { "Content-Type": "application/json" },
Expand All @@ -519,7 +519,7 @@ export const api = {
fetchJSON<CronJob>(`/api/cron/jobs/${encodeURIComponent(id)}/pause?profile=${encodeURIComponent(profile)}`, { method: "POST" }),
updateCronJob: (
id: string,
updates: { prompt?: string; schedule?: string; name?: string; deliver?: string; skills?: string[] },
updates: { prompt?: string; schedule?: string; name?: string; deliver?: string; skills?: string[]; model?: string | null },
profile = "default",
) =>
fetchJSON<CronJob>(
Expand Down Expand Up @@ -1878,6 +1878,7 @@ export interface CronJob {
enabled: boolean;
state?: string | null;
deliver?: string | null;
model?: string | null;
last_run_at?: string | null;
next_run_at?: string | null;
last_error?: string | null;
Expand Down
36 changes: 36 additions & 0 deletions web/src/pages/CronPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ export default function CronPage() {
DEFAULT_SCHEDULE_STATE,
);
const [name, setName] = useState("");
const [model, setModel] = useState("");
const closeCreateModal = useCallback(() => setCreateModalOpen(false), []);
const createModalRef = useModalBehavior({
open: createModalOpen,
Expand All @@ -229,6 +230,7 @@ export default function CronPage() {
const [editPrompt, setEditPrompt] = useState("");
const [editSchedule, setEditSchedule] = useState("");
const [editName, setEditName] = useState("");
const [editModel, setEditModel] = useState("");
const [editDeliver, setEditDeliver] = useState("local");
const [editSkills, setEditSkills] = useState<string[]>([]);
const [saving, setSaving] = useState(false);
Expand All @@ -251,6 +253,7 @@ export default function CronPage() {
asText(job.schedule?.expr) || asText(job.schedule_display) || "",
);
setEditName(getJobName(job));
setEditModel(asText(job.model));
setEditDeliver(asText(job.deliver) || "local");
setEditSkills(Array.isArray(job.skills) ? job.skills.filter(Boolean) : []);
}, []);
Expand Down Expand Up @@ -373,13 +376,15 @@ export default function CronPage() {
name: name.trim() || undefined,
deliver,
skills: jobSkills.length > 0 ? jobSkills : undefined,
model: model.trim() || undefined,
},
createProfile,
);
showToast(t.common.create + " ✓", "success");
setPrompt("");
setScheduleState(DEFAULT_SCHEDULE_STATE);
setName("");
setModel("");
setDeliver("local");
setJobSkills([]);
setCreateModalOpen(false);
Expand Down Expand Up @@ -407,6 +412,7 @@ export default function CronPage() {
name: editName.trim(),
deliver: editDeliver,
skills: editSkills,
model: editModel.trim() || null,
},
getJobProfile(editJob),
);
Expand Down Expand Up @@ -610,6 +616,21 @@ export default function CronPage() {
/>
</div>

<div className="grid gap-2">
<Label htmlFor="cron-model">
{t.cron.modelOptional ?? "Model (optional)"}
</Label>
<Input
id="cron-model"
placeholder={
t.cron.modelPlaceholder ??
"e.g. moonshotai/kimi-k2.6 (leaves the gateway default if empty)"
}
value={model}
onChange={(e) => setModel(e.target.value)}
/>
</div>

<ScheduleBuilder
value={scheduleState}
onChange={setScheduleState}
Expand Down Expand Up @@ -716,6 +737,21 @@ export default function CronPage() {
/>
</div>

<div className="grid gap-2">
<Label htmlFor="edit-cron-model">
{t.cron.modelOptional ?? "Model (optional)"}
</Label>
<Input
id="edit-cron-model"
placeholder={
t.cron.modelPlaceholder ??
"e.g. moonshotai/kimi-k2.6 (leaves the gateway default if empty)"
}
value={editModel}
onChange={(e) => setEditModel(e.target.value)}
/>
</div>

<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div className="grid gap-2">
<Label htmlFor="edit-cron-schedule">{t.cron.schedule}</Label>
Expand Down