fix: job edit schedule format error and refactor services directory
- Fix #25: job update sends schedule as plain string but upstream expects { kind, expr, display } object, causing "'str' object has no attribute 'get'" - Move hermes-cli.ts, hermes.ts, hermes-profile.ts into services/hermes/ for multi-agent namespacing consistency - Fix ts-node Set spread compatibility in filesystem.ts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -45,7 +45,7 @@ export interface CreateJobRequest {
|
||||
|
||||
export interface UpdateJobRequest {
|
||||
name?: string
|
||||
schedule?: string
|
||||
schedule?: string | { kind: string; expr: string; display: string }
|
||||
prompt?: string
|
||||
deliver?: string
|
||||
skills?: string[]
|
||||
|
||||
@@ -48,6 +48,8 @@ const targetOptions = computed(() => [
|
||||
{ label: t('jobs.local'), value: 'local' },
|
||||
])
|
||||
|
||||
const originalSchedule = ref<{ kind: string; expr: string; display: string } | null>(null)
|
||||
|
||||
onMounted(async () => {
|
||||
if (props.jobId) {
|
||||
try {
|
||||
@@ -60,6 +62,9 @@ onMounted(async () => {
|
||||
deliver: job.deliver || 'origin',
|
||||
repeat_times: typeof job.repeat === 'number' ? job.repeat : (typeof job.repeat === 'object' ? job.repeat.times : null),
|
||||
}
|
||||
if (typeof job.schedule === 'object' && job.schedule) {
|
||||
originalSchedule.value = job.schedule
|
||||
}
|
||||
} catch (e: any) {
|
||||
message.error(t('jobs.loadFailed') + ': ' + e.message)
|
||||
}
|
||||
@@ -86,6 +91,14 @@ async function handleSave() {
|
||||
repeat: formData.value.repeat_times ?? undefined,
|
||||
}
|
||||
|
||||
if (isEdit.value && originalSchedule.value) {
|
||||
(payload as any).schedule = {
|
||||
kind: originalSchedule.value.kind,
|
||||
expr: formData.value.schedule,
|
||||
display: formData.value.schedule,
|
||||
}
|
||||
}
|
||||
|
||||
if (isEdit.value) {
|
||||
await jobsStore.updateJob(props.jobId!, payload)
|
||||
message.success(t('jobs.jobUpdated'))
|
||||
|
||||
Reference in New Issue
Block a user