Merge one AgentConfig into another (simple field-level merge).
(target: &mut AgentConfig, source: AgentConfig)
| 1144 | |
| 1145 | /// Merge one AgentConfig into another (simple field-level merge). |
| 1146 | fn merge_agent_config(target: &mut AgentConfig, source: AgentConfig) { |
| 1147 | if source.name.is_some() { |
| 1148 | target.name = source.name; |
| 1149 | } |
| 1150 | if source.model.is_some() { |
| 1151 | target.model = source.model; |
| 1152 | } |
| 1153 | if source.variant.is_some() { |
| 1154 | target.variant = source.variant; |
| 1155 | } |
| 1156 | if source.temperature.is_some() { |
| 1157 | target.temperature = source.temperature; |
| 1158 | } |
| 1159 | if source.top_p.is_some() { |
| 1160 | target.top_p = source.top_p; |
| 1161 | } |
| 1162 | if source.prompt.is_some() { |
| 1163 | target.prompt = source.prompt; |
| 1164 | } |
| 1165 | if source.disable.is_some() { |
| 1166 | target.disable = source.disable; |
| 1167 | } |
| 1168 | if source.description.is_some() { |
| 1169 | target.description = source.description; |
| 1170 | } |
| 1171 | if source.mode.is_some() { |
| 1172 | target.mode = source.mode; |
| 1173 | } |
| 1174 | if source.hidden.is_some() { |
| 1175 | target.hidden = source.hidden; |
| 1176 | } |
| 1177 | if source.color.is_some() { |
| 1178 | target.color = source.color; |
| 1179 | } |
| 1180 | if source.steps.is_some() { |
| 1181 | target.steps = source.steps; |
| 1182 | } |
| 1183 | if source.max_steps.is_some() { |
| 1184 | target.max_steps = source.max_steps; |
| 1185 | } |
| 1186 | if source.max_tokens.is_some() { |
| 1187 | target.max_tokens = source.max_tokens; |
| 1188 | } |
| 1189 | if let Some(source_opts) = source.options { |
| 1190 | let target_opts = target.options.get_or_insert_with(HashMap::new); |
| 1191 | for (k, v) in source_opts { |
| 1192 | target_opts.insert(k, v); |
| 1193 | } |
| 1194 | } |
| 1195 | if let Some(source_perm) = source.permission { |
| 1196 | if let Some(target_perm) = &mut target.permission { |
| 1197 | for (k, v) in source_perm.rules { |
| 1198 | target_perm.rules.insert(k, v); |
| 1199 | } |
| 1200 | } else { |
| 1201 | target.permission = Some(source_perm); |
| 1202 | } |
| 1203 | } |
no outgoing calls
no test coverage detected