fix: wire agent group selection through to simulation start
Step 2 -> Step 3 -> Simulation API now passes selected_agent_ids.
Backend filters reddit_profiles.json and twitter_profiles.csv
to only include selected agents before starting simulation.
Flow: Step2 checkboxes -> emit('next-step', {selectedAgentIds}) ->
router query -> Step3 props -> startSimulation API -> filter profiles
This commit is contained in:
@@ -834,6 +834,12 @@ const handleStartSimulation = () => {
|
||||
addLog(t('log.startSimAutoRounds', { rounds: autoGeneratedRounds.value }))
|
||||
}
|
||||
|
||||
// Pass selected agent IDs (filtered by group checkboxes)
|
||||
params.selectedAgentIds = getSelectedAgentIds()
|
||||
if (agentGroups.value.length > 0) {
|
||||
addLog(`✅ ส่ง ${params.selectedAgentIds.length} agents ไปขั้นตอนถัดไป`)
|
||||
}
|
||||
|
||||
emit('next-step', params)
|
||||
}
|
||||
|
||||
|
||||
@@ -301,7 +301,8 @@ const { t } = useI18n()
|
||||
|
||||
const props = defineProps({
|
||||
simulationId: String,
|
||||
maxRounds: Number, // 从Step2传入的最大轮数
|
||||
maxRounds: Number,
|
||||
selectedAgentIds: Array, // Agent IDs selected from Step 2 grouping // 从Step2传入的最大轮数
|
||||
minutesPerRound: {
|
||||
type: Number,
|
||||
default: 30 // 默认每轮30分钟
|
||||
@@ -407,6 +408,12 @@ const doStartSimulation = async () => {
|
||||
addLog(t('log.setMaxRounds', { rounds: props.maxRounds }))
|
||||
}
|
||||
|
||||
// Pass selected agent IDs from Step 2 grouping
|
||||
if (props.selectedAgentIds && props.selectedAgentIds.length > 0) {
|
||||
params.selected_agent_ids = props.selectedAgentIds
|
||||
addLog(`✅ ใช้ ${props.selectedAgentIds.length} agents ที่เลือก`)
|
||||
}
|
||||
|
||||
addLog(t('log.graphMemoryUpdateEnabled'))
|
||||
|
||||
const res = await startSimulation(params)
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
<Step3Simulation
|
||||
:simulationId="currentSimulationId"
|
||||
:maxRounds="maxRounds"
|
||||
:selectedAgentIds="selectedAgentIds"
|
||||
:minutesPerRound="minutesPerRound"
|
||||
:projectData="projectData"
|
||||
:graphData="graphData"
|
||||
@@ -94,6 +95,7 @@ const viewMode = ref('split')
|
||||
const currentSimulationId = ref(route.params.simulationId)
|
||||
// 直接在初始化时从 query 参数获取 maxRounds,确保子组件能立即获取到值
|
||||
const maxRounds = ref(route.query.maxRounds ? parseInt(route.query.maxRounds) : null)
|
||||
const selectedAgentIds = ref(route.query.selectedAgentIds ? route.query.selectedAgentIds.split(',').map(Number) : null)
|
||||
const minutesPerRound = ref(30) // 默认每轮30分钟
|
||||
const projectData = ref(null)
|
||||
const graphData = ref(null)
|
||||
|
||||
@@ -167,8 +167,15 @@ const handleNextStep = (params = {}) => {
|
||||
}
|
||||
|
||||
// 如果有自定义轮数,通过 query 参数传递
|
||||
const query = {}
|
||||
if (params.maxRounds) {
|
||||
routeParams.query = { maxRounds: params.maxRounds }
|
||||
query.maxRounds = params.maxRounds
|
||||
}
|
||||
if (params.selectedAgentIds && params.selectedAgentIds.length > 0) {
|
||||
query.selectedAgentIds = params.selectedAgentIds.join(',')
|
||||
}
|
||||
if (Object.keys(query).length > 0) {
|
||||
routeParams.query = query
|
||||
}
|
||||
|
||||
// 跳转到 Step 3 页面
|
||||
|
||||
Reference in New Issue
Block a user