File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
crates/chat-cli/src/cli/agent Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -131,10 +131,11 @@ pub enum AgentConfigError {
131131pub struct Agent {
132132 #[ serde(
133133 rename = "$schema" ,
134- default = "default_schema" ,
135- skip_serializing_if = "String::is_empty"
134+ default ,
135+ skip_serializing_if = "Option::is_none" ,
136+ deserialize_with = "deserialize_optional_string"
136137 ) ]
137- pub schema : String ,
138+ pub schema : Option ,
138139 /// Name of the agent
139140 pub name : String ,
140141 /// This field is not model facing and is mostly here for users to discern between agents
@@ -181,9 +182,18 @@ pub struct Agent {
181182 pub path : Option < PathBuf > ,
182183}
183184
185+ fn deserialize_optional_string < ' de , D > ( deserializer : D ) -> Result , D :: Error >
186+ where
187+ D : serde:: Deserializer < ' de > ,
188+ {
189+ let opt = Option :: :: deserialize ( deserializer) ?;
190+ Ok ( opt. filter ( |s| !s. is_empty ( ) ) )
191+ }
192+
184193impl Default for Agent {
185194 fn default ( ) -> Self {
186195 Self {
196+ schema : None ,
187197 name : DEFAULT_AGENT_NAME . to_string ( ) ,
188198 description : Some ( "Default agent" . to_string ( ) ) ,
189199 prompt : Default :: default ( ) ,
You can’t perform that action at this time.
0 commit comments