mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 08:43:02 +08:00
refactor(action-planner): simplify tendencies state hint naming and always follow up on refused candidates
This commit is contained in:
@@ -42,7 +42,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
public class ActionPlanner extends AbstractAgentModule.Running<PartnerRunningFlowContext> {
|
public class ActionPlanner extends AbstractAgentModule.Running<PartnerRunningFlowContext> {
|
||||||
|
|
||||||
private static final String IMMEDIATE_WATCHER_CRON = "0/5 * * * * ?";
|
private static final String IMMEDIATE_WATCHER_CRON = "0/5 * * * * ?";
|
||||||
private static final String TENDENCIES_EVALUATING_BLOCK_NAME = "action_tendencies_under_evaluation";
|
private static final String TENDENCIES_EVALUATING_BLOCK_NAME = "tendencies_under_evaluation";
|
||||||
|
|
||||||
private final ActionAssemblyHelper assemblyHelper = new ActionAssemblyHelper();
|
private final ActionAssemblyHelper assemblyHelper = new ActionAssemblyHelper();
|
||||||
|
|
||||||
@@ -96,12 +96,12 @@ public class ActionPlanner extends AbstractAgentModule.Running<PartnerRunningFlo
|
|||||||
));
|
));
|
||||||
|
|
||||||
cognitionCapability.contextWorkspace().register(StateHintContent.createBlock(new StateHintContent(
|
cognitionCapability.contextWorkspace().register(StateHintContent.createBlock(new StateHintContent(
|
||||||
"action_tendencies_under_evaluation",
|
"tendencies_under_evaluation",
|
||||||
"Partner is evaluating whether any action tendency should be taken for the latest input."
|
"Partner is evaluating whether any action tendency should be taken for the latest input."
|
||||||
) {
|
) {
|
||||||
@Override
|
@Override
|
||||||
public void fillStateContent(@NotNull Document document, @NotNull Element stateElement) {
|
public void fillStateContent(@NotNull Document document, @NotNull Element stateElement) {
|
||||||
appendListElement(document, stateElement, "action_tendencies", "tendency", tendencies);
|
appendListElement(document, stateElement, "tendencies", "tendency", tendencies);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ public class ActionPlanner extends AbstractAgentModule.Running<PartnerRunningFlo
|
|||||||
}
|
}
|
||||||
executeOrSchedule(executableAction);
|
executeOrSchedule(executableAction);
|
||||||
}
|
}
|
||||||
if (hasPassedAction && !refusedTendencies.isEmpty()) {
|
if (!refusedTendencies.isEmpty()) {
|
||||||
cognitionCapability.initiateTurn("Some candidate action tendencies were refused during evaluation. If any of them were promised to the user, acknowledge that they will not be executed and explain why.", source, getModuleName());
|
cognitionCapability.initiateTurn("Some candidate action tendencies were refused during evaluation. If any of them were promised to the user, acknowledge that they will not be executed and explain why.", source, getModuleName());
|
||||||
}
|
}
|
||||||
if (hasPendingConfirmation) {
|
if (hasPendingConfirmation) {
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ object ModelRuntimeRegistry : Configurable, ConfigRegistration<ModelRuntimeRegis
|
|||||||
try {
|
try {
|
||||||
val parsedConfig = parseJsonConfig(root)
|
val parsedConfig = parseJsonConfig(root)
|
||||||
applyConfig(parsedConfig)
|
applyConfig(parsedConfig)
|
||||||
|
log.info("Model config updated")
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
log.error("Error while loading runtime provider config", e)
|
log.error("Error while loading runtime provider config", e)
|
||||||
baseProvider.clear()
|
baseProvider.clear()
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public class OpenAiCompatibleProvider extends ModelProvider {
|
|||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
String jsonInstruction = "Return only a valid JSON object that matches the requested response schema.";
|
String jsonInstruction = "Return only a valid JSON object.";
|
||||||
List<Message> patched = new ArrayList<>(messages.size() + 1);
|
List<Message> patched = new ArrayList<>(messages.size() + 1);
|
||||||
boolean merged = false;
|
boolean merged = false;
|
||||||
for (Message message : messages) {
|
for (Message message : messages) {
|
||||||
|
|||||||
Reference in New Issue
Block a user