feat: weakup tweet

This commit is contained in:
2026-03-16 16:17:44 +08:00
parent 8d30a0419d
commit 81a22a2b54
6 changed files with 42 additions and 0 deletions

View File

@@ -113,6 +113,24 @@ class TerminalResource extends Resource
])
->columns(2),
Forms\Components\Section::make('语音唤醒')
->schema([
Forms\Components\Toggle::make('voice_wakeup_enabled')
->label('启用语音唤醒')
->default(false)
->live()
->helperText('开启后终端将启用语音唤醒功能'),
Forms\Components\TextInput::make('voice_wakeup_word')
->label('唤醒词')
->maxLength(100)
->placeholder('例如: 你好小智')
->helperText('终端语音唤醒使用的唤醒词')
->visible(fn(Forms\Get $get): bool => (bool) $get('voice_wakeup_enabled')),
])
->columns(2)
->description('配置终端的语音唤醒能力'),
Forms\Components\Section::make('知识库关联')
->schema([
Forms\Components\Repeater::make('knowledgeBaseAssociations')

View File

@@ -79,6 +79,21 @@ class ViewTerminal extends ViewRecord
])
->collapsible(),
Infolists\Components\Section::make('语音唤醒')
->schema([
Infolists\Components\IconEntry::make('voice_wakeup_enabled')
->label('语音唤醒')
->boolean()
->trueIcon('heroicon-o-check-circle')
->falseIcon('heroicon-o-x-circle')
->trueColor('success')
->falseColor('danger'),
Infolists\Components\TextEntry::make('voice_wakeup_word')
->label('唤醒词')
->placeholder('未设置'),
])
->columns(2),
Infolists\Components\Section::make('状态信息')
->schema([
Infolists\Components\IconEntry::make('is_online')

View File

@@ -47,6 +47,8 @@ class TerminalApiController extends Controller
'diagram_url' => $terminal->diagram_url,
'scada_data_url' => $terminal->scada_data_url,
'scada_tags_url' => $terminal->scada_tags_url,
'voice_wakeup_enabled' => $terminal->voice_wakeup_enabled,
'voice_wakeup_word' => $terminal->voice_wakeup_word,
],
'system_prompt' => $systemPrompt,
'guide_count' => $guideCount,

View File

@@ -26,6 +26,8 @@ class Terminal extends Model
'diagram_url',
'scada_data_url',
'scada_tags_url',
'voice_wakeup_enabled',
'voice_wakeup_word',
'is_online',
'last_online_at',
];
@@ -38,6 +40,7 @@ class Terminal extends Model
protected function casts(): array
{
return [
'voice_wakeup_enabled' => 'boolean',
'is_online' => 'boolean',
'last_online_at' => 'datetime',
];

View File

@@ -30,6 +30,8 @@ class TerminalFactory extends Factory
'ip_address' => fake()->localIpv4(),
'station_id' => null, // 需要关联实际的线站ID
'diagram_url' => fake()->imageUrl(1920, 1080, 'diagram', true),
'voice_wakeup_enabled' => false,
'voice_wakeup_word' => null,
'is_online' => fake()->boolean(70), // 70%概率在线
'last_online_at' => fake()->dateTimeBetween('-7 days', 'now'),
];

View File

@@ -21,6 +21,8 @@ return new class extends Migration
$table->string('diagram_url', 500)->nullable()->comment('组态界面地址');
$table->string('scada_data_url', 500)->nullable()->comment('网关数据查询地址');
$table->string('scada_tags_url', 500)->nullable()->comment('网关点位定义查询地址');
$table->boolean('voice_wakeup_enabled')->default(false)->comment('语音唤醒是否启用');
$table->string('voice_wakeup_word', 100)->nullable()->comment('语音唤醒词');
$table->boolean('is_online')->default(false)->comment('在线状态');
$table->timestamp('last_online_at')->nullable()->comment('最后在线时间');
$table->timestamps();