feat: add optional custom argument topic override via Web UI

- Added optional 'topic' field to BipolarTriggerRequest model
- Added topic parameter to force_trigger_argument and force_trigger_argument_from_message_id
- Updated run_argument to accept optional custom topic (None=random, ''=no topic, str=custom)
- Added topic input field to Web UI trigger-argument section
- Updated JS to send topic in API request body
- Custom topics bypass the random rotation system, allowing manual theme control
This commit is contained in:
2026-04-30 12:07:28 +03:00
parent 98fca53066
commit 846557fa96
5 changed files with 40 additions and 10 deletions

View File

@@ -238,6 +238,14 @@
<input type="text" id="bipolar-context" placeholder="e.g., They're fighting about who's the real Miku..." style="width: 100%; margin-top: 0.3rem;">
</div>
<div style="margin-bottom: 1rem;">
<label for="bipolar-topic">Argument Topic (optional — overrides random topic):</label>
<input type="text" id="bipolar-topic" placeholder="e.g., Who deserves the spotlight? A philosophical debate about worth..." style="width: 100%; margin-top: 0.3rem;">
<div style="font-size: 0.75rem; color: #777; margin-top: 0.2rem;">
Leave blank for random topic selection. Enter a custom theme to frame the argument uniquely.
</div>
</div>
<button onclick="triggerBipolarArgument()" style="background: #9932CC; color: #fff; border: none; padding: 0.5rem 1rem; border-radius: 4px; cursor: pointer;">
⚔️ Trigger Argument
</button>

View File

@@ -249,6 +249,7 @@ async function triggerBipolarArgument() {
const channelIdInput = document.getElementById('bipolar-channel-id').value.trim();
const messageIdInput = document.getElementById('bipolar-message-id').value.trim();
const context = document.getElementById('bipolar-context').value;
const topic = document.getElementById('bipolar-topic').value.trim();
const statusDiv = document.getElementById('bipolar-status');
if (!channelIdInput) {
@@ -278,6 +279,10 @@ async function triggerBipolarArgument() {
requestBody.message_id = messageIdInput;
}
if (topic) {
requestBody.topic = topic;
}
const result = await apiCall('/bipolar-mode/trigger-argument', 'POST', requestBody);
if (result.status === 'error') {
@@ -290,6 +295,7 @@ async function triggerBipolarArgument() {
showNotification(`⚔️ Argument triggered!`);
document.getElementById('bipolar-context').value = '';
document.getElementById('bipolar-topic').value = '';
document.getElementById('bipolar-message-id').value = '';
loadActiveArguments();