视图分组
-
+
第 {{ group.groupIndex + 1 }} 组
{{ group.label }}
-
+
@@ -192,11 +245,16 @@
@@ -206,10 +264,15 @@
视图:
-
+
-
{{ statusText }}
-
切换中...
+
{{ statusText
+ }}
+
切换中...
@@ -217,10 +280,12 @@
- aiConfig[key] = value" />
- {}" />
+ aiConfig[key] = value" />
+ { }" />
-
+
@@ -252,7 +317,7 @@ const isPreparing = ref(false)
const isStarting = ref(false)
const isStopping = ref(false)
const isSwitchingView = ref(false)
-const configForm = reactive({ prologueList: {}, needTranslate: false, dataPoolSource: 'anchor_hosts', replyMessagesText: '', replyUnreadMessages: true, groupSwitchMinutes: 10, groupViewCounts: [...DEFAULT_GROUP_COUNTS] })
+const configForm = reactive({ prologueList: {}, needTranslate: false, dataPoolSource: 'anchor_hosts', replyMessagesText: '', replyUnreadMessages: true, groupSwitchMinutes: 10, postUserSleepSeconds: 6, groupViewCounts: [...DEFAULT_GROUP_COUNTS] })
const aiConfig = ref({ agentName: '', guildName: '', contactTool: '', contact: '' })
const sidebarStyle = computed(() => ({ width: `${props.navSidebarWidth}px`, minWidth: '96px', maxWidth: '400px' }))
const greetingMessages = computed(() => {
@@ -274,14 +339,16 @@ const browserViewGroups = computed(() => normalizedGroupViewCounts.value.map((en
const viewIds = computed(() => browserViewGroups.value.flatMap(group => group.views.filter(view => view.enabled).map(view => view.viewId)))
const totalEnabledViews = computed(() => normalizedGroupViewCounts.value.reduce((sum, count) => sum + count, 0))
const payloadPreview = computed(() => JSON.stringify(buildStartPayload(), null, 2))
-const currentPrepareKey = computed(() => JSON.stringify({ groupViewCounts: normalizedGroupViewCounts.value, groupSwitchMinutes: normalizedGroupSwitchMinutes.value, replyUnreadMessages: Boolean(configForm.replyUnreadMessages), dataPoolSource: configForm.dataPoolSource, replyMessages: replyMessages.value, prologueList: configForm.prologueList || {}, needTranslate: Boolean(configForm.needTranslate) }))
+const currentPrepareKey = computed(() => JSON.stringify({ groupViewCounts: normalizedGroupViewCounts.value, groupSwitchMinutes: normalizedGroupSwitchMinutes.value, postUserSleepSeconds: normalizedPostUserSleepSeconds.value, replyUnreadMessages: Boolean(configForm.replyUnreadMessages), dataPoolSource: configForm.dataPoolSource, replyMessages: replyMessages.value, prologueList: configForm.prologueList || {}, needTranslate: Boolean(configForm.needTranslate) }))
const hasPreparedViews = computed(() => preparedConfigKey.value === currentPrepareKey.value)
const statusChipClass = computed(() => statusText.value.includes('运行') ? 'rounded-full border border-emerald-200 bg-emerald-50 px-3 py-1 text-xs font-medium text-emerald-700' : statusText.value.includes('失败') ? 'rounded-full border border-rose-200 bg-rose-50 px-3 py-1 text-xs font-medium text-rose-700' : 'rounded-full border border-amber-200 bg-amber-50 px-3 py-1 text-xs font-medium text-amber-700')
function clampMinutes(value) { const numericValue = Number(value); return !Number.isFinite(numericValue) || numericValue <= 0 ? 10 : Math.max(1, Math.round(numericValue)) }
+function clampPositiveSeconds(value, fallback = 6) { const numericValue = Number(value); return !Number.isFinite(numericValue) || numericValue <= 0 ? fallback : Math.max(1, Math.round(numericValue)) }
function clampGroupCount(value) { const numericValue = Number(value); return !Number.isFinite(numericValue) ? 0 : Math.min(3, Math.max(0, Math.round(numericValue))) }
function normalizeGroupViewCounts(values) { const safeValues = Array.isArray(values) ? values.slice(0, 3) : []; while (safeValues.length < 3) safeValues.push(0); return safeValues.map(clampGroupCount) }
+const normalizedPostUserSleepSeconds = computed(() => clampPositiveSeconds(configForm.postUserSleepSeconds, 6))
function buildStartPayload() {
- const payload = { dataPoolSource: configForm.dataPoolSource, replyUnreadMessages: Boolean(configForm.replyUnreadMessages), groupSwitchMinutes: normalizedGroupSwitchMinutes.value, groupViewCounts: normalizedGroupViewCounts.value, prologueList: JSON.parse(JSON.stringify(configForm.prologueList || {})), needTranslate: Boolean(configForm.needTranslate) }
+ const payload = { dataPoolSource: configForm.dataPoolSource, replyUnreadMessages: Boolean(configForm.replyUnreadMessages), groupSwitchMinutes: normalizedGroupSwitchMinutes.value, postUserSleepSeconds: normalizedPostUserSleepSeconds.value, groupViewCounts: normalizedGroupViewCounts.value, prologueList: JSON.parse(JSON.stringify(configForm.prologueList || {})), needTranslate: Boolean(configForm.needTranslate) }
if (greetingMessages.value.length > 0) payload.greetingMessages = greetingMessages.value
if (replyMessages.value.length > 0) payload.replyMessages = replyMessages.value
return payload
@@ -290,6 +357,7 @@ function ensureElectronCapability(methodName) { if (!isElectronEnv || !window.el
function invalidatePreparedState(nextStatus = '配置已变更,请重新预热视图') { preparedConfigKey.value = ''; loginConfirmed.value = false; if (!statusText.value.includes('运行')) statusText.value = nextStatus }
function handleGreetingConfirm(data) { configForm.prologueList = { yolo: data.sentences || [], ...(data.translations || {}) }; configForm.needTranslate = Boolean(data.needTranslate); showGreetingDialog.value = false; invalidatePreparedState(); void saveSharedConfig() }
function handleSwitchMinutesBlur() { configForm.groupSwitchMinutes = clampMinutes(configForm.groupSwitchMinutes); invalidatePreparedState() }
+function handlePostUserSleepBlur() { configForm.postUserSleepSeconds = clampPositiveSeconds(configForm.postUserSleepSeconds, 6); invalidatePreparedState() }
function handleGroupCountBlur(index) { configForm.groupViewCounts[index] = clampGroupCount(configForm.groupViewCounts[index]); invalidatePreparedState('视图配置已变更,请重新预热视图') }
function groupViewText(count) { return count <= 0 ? '不启用' : `开启 ${count} 个` }
function groupRangeLabel(index) { const startViewId = TIKTOK_VIEW_IDS[index * 3]; const endViewId = TIKTOK_VIEW_IDS[index * 3 + 2]; return `视图 ${startViewId}-${endViewId}` }
@@ -318,6 +386,7 @@ async function loadSharedConfig() {
if (typeof saved?.needTranslate === 'boolean') configForm.needTranslate = saved.needTranslate
if (saved?.standaloneTikTokDataPoolSource === 'anchor_hosts' || saved?.standaloneTikTokDataPoolSource === 'brother_info') configForm.dataPoolSource = saved.standaloneTikTokDataPoolSource
if (Array.isArray(saved?.standaloneTikTokReplyMessages)) configForm.replyMessagesText = saved.standaloneTikTokReplyMessages.join('\n')
+ if (saved?.standaloneTikTokPostUserSleepSeconds !== undefined) configForm.postUserSleepSeconds = clampPositiveSeconds(saved.standaloneTikTokPostUserSleepSeconds, 6)
} catch (error) {
console.error('load shared config failed:', error)
}
@@ -331,7 +400,8 @@ async function saveSharedConfig() {
prologueList: JSON.parse(JSON.stringify(configForm.prologueList || {})),
needTranslate: Boolean(configForm.needTranslate),
standaloneTikTokDataPoolSource: configForm.dataPoolSource,
- standaloneTikTokReplyMessages: replyMessages.value
+ standaloneTikTokReplyMessages: replyMessages.value,
+ standaloneTikTokPostUserSleepSeconds: normalizedPostUserSleepSeconds.value
}
await window.electronAPI.saveRunConfig(nextConfig)
} catch (error) {
@@ -352,7 +422,7 @@ async function handlePrepareViews() {
if (result.currentViewId) activeViewId.value = result.currentViewId
preparedConfigKey.value = currentPrepareKey.value
await saveSharedConfig()
- pageMode.value = 'browser'
+ // pageMode.value = 'browser'
await window.electronAPI.showViews()
statusText.value = `视图已预热,请先在视图 ${activeViewId.value} 手动登录,再启动脚本`
ElMessage.success('视图预热完成,已切换到浏览器视图')
@@ -481,16 +551,16 @@ watch(viewIds, (nextViewIds) => {
}, { immediate: true })
watch(pageMode, async (newVal) => {
if (!isElectronEnv) return
- if (newVal === 'config' && window.electronAPI?.hideViews) await window.electronAPI.hideViews().catch(() => {})
+ if (newVal === 'config' && window.electronAPI?.hideViews) await window.electronAPI.hideViews().catch(() => { })
})
onMounted(async () => {
await checkAIConfig()
await loadSharedConfig()
if (!isElectronEnv || !window.electronAPI?.hideViews) return
- await window.electronAPI.hideViews().catch(() => {})
+ await window.electronAPI.hideViews().catch(() => { })
})
onUnmounted(async () => {
if (!isElectronEnv || !window.electronAPI?.hideViews) return
- await window.electronAPI.hideViews().catch(() => {})
+ await window.electronAPI.hideViews().catch(() => { })
})
diff --git a/src/views/tk/FanWorkbench.vue b/src/views/tk/FanWorkbench.vue
index ff7206f..968f764 100644
--- a/src/views/tk/FanWorkbench.vue
+++ b/src/views/tk/FanWorkbench.vue
@@ -60,7 +60,7 @@
class="!rounded-xl !font-semibold shadow-lg shadow-blue-500/20">
📍
{{ streamdialogVisibletext ? ($t('hostsList.specifiedRooms') || '已指定') : ($t('hostsList.specifyRooms') ||
- '指定直播间') }}
+ '指定直播间') }}
{
- return userInfo.value.tenantId == 12384 ? 5000 : 50;
+ return userInfo.value.tenantId == 12384 || userInfo.value.tenantId == 12741 ? 5000 : 50;
});
// 当前行数