command->info('开始创建终端数据...'); // 光束线列表 $beamlines = [ 'BL02U1' => '192.168.1.21', 'BL07U' => '192.168.1.27', 'BL08U' => '192.168.1.28', 'BL13HB' => '192.168.1.33', 'BL13U' => '192.168.1.34', 'BL14B' => '192.168.1.35', 'BL14W' => '192.168.1.36', 'BL15U' => '192.168.1.37', 'BL16B' => '192.168.1.38', 'BL16U1' => '192.168.1.39', ]; // 默认提示词模板(占位符由HMI端替换) $defaultPrompt = <<<'PROMPT' 你是{station_id}光束线的AI助手。当前时间是{time}。请根据用户{user}的问题,提供准确的光束线操作指导、实验支持和技术咨询。你可以回答关于光束线参数、实验流程、设备状态、安全规范等方面的问题。 PROMPT; // 为每条光束线创建智慧屏终端 $this->command->info('创建光束线智慧屏终端...'); foreach ($beamlines as $beamline => $ipAddress) { $terminal = Terminal::create([ 'name' => "{$beamline} 智慧屏", 'code' => "SCREEN-{$beamline}", 'ip_address' => $ipAddress, 'station_id' => $beamline, 'diagram_url' => 'https://ssrf.9z.work/scada/demo.html', 'is_online' => in_array($beamline, ['BL02U1', 'BL07U', 'BL08U', 'BL13U', 'BL15U']), 'last_online_at' => in_array($beamline, ['BL02U1', 'BL07U', 'BL08U', 'BL13U', 'BL15U']) ? now() : now()->subHours(rand(1, 24)), ]); // 为每个终端创建提示词 TerminalPrompt::create([ 'terminal_id' => $terminal->id, 'prompt_template' => $defaultPrompt, 'variables' => [], ]); } $this->command->info('终端数据创建完成!'); $this->command->newLine(); $this->command->info('=== 生成的终端摘要 ==='); $this->command->info('总终端数量: ' . Terminal::count()); $this->command->info(' - 在线终端: ' . Terminal::where('is_online', true)->count()); $this->command->info(' - 离线终端: ' . Terminal::where('is_online', false)->count()); $this->command->info(' - 配置提示词的终端: ' . TerminalPrompt::count()); } }