mirror of
https://github.com/hanzoai/dev.git
synced 2026-10-25 03:32:32 +00:00
fix(tui/auto_observer): require mandatory observer fields
This commit is contained in:
@@ -190,22 +190,29 @@ fn run_observer_prompt(
|
|||||||
other => return Err(anyhow!("unexpected status '{other}'")),
|
other => return Err(anyhow!("unexpected status '{other}'")),
|
||||||
};
|
};
|
||||||
|
|
||||||
let replace_message = response
|
let trimmed_replace_message = response
|
||||||
.replace_message
|
.replace_message
|
||||||
.map(|s| s.trim().to_string())
|
.map(|s| s.trim().to_string())
|
||||||
.filter(|s| !s.is_empty());
|
.filter(|s| !s.is_empty());
|
||||||
let additional_instructions = response
|
let trimmed_additional_instructions = response
|
||||||
.additional_instructions
|
.additional_instructions
|
||||||
.map(|s| s.trim().to_string())
|
.map(|s| s.trim().to_string())
|
||||||
.filter(|s| !s.is_empty());
|
.filter(|s| !s.is_empty());
|
||||||
|
|
||||||
if matches!(status, AutoObserverStatus::Failing)
|
if matches!(status, AutoObserverStatus::Failing)
|
||||||
&& replace_message.is_none()
|
&& trimmed_replace_message.is_none()
|
||||||
&& additional_instructions.is_none()
|
&& trimmed_additional_instructions.is_none()
|
||||||
{
|
{
|
||||||
warn!("observer returned failing status without guidance");
|
warn!("observer returned failing status without guidance");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let (replace_message, additional_instructions) =
|
||||||
|
if matches!(status, AutoObserverStatus::Failing) {
|
||||||
|
(trimmed_replace_message, trimmed_additional_instructions)
|
||||||
|
} else {
|
||||||
|
(None, None)
|
||||||
|
};
|
||||||
|
|
||||||
debug!(
|
debug!(
|
||||||
"[Auto observer] status={status:?} replace={} instructions={}",
|
"[Auto observer] status={status:?} replace={} instructions={}",
|
||||||
replace_message.is_some(),
|
replace_message.is_some(),
|
||||||
@@ -330,7 +337,7 @@ fn build_observer_schema() -> Value {
|
|||||||
"minLength": 1,
|
"minLength": 1,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["status"],
|
"required": ["status", "replace_message", "additional_instructions"],
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user