feat: prompt from station
This commit is contained in:
@@ -18,26 +18,4 @@ class CreateTerminal extends CreateRecord
|
||||
{
|
||||
return '终端创建成功';
|
||||
}
|
||||
|
||||
protected function mutateFormDataBeforeCreate(array $data): array
|
||||
{
|
||||
// 提取提示词数据,稍后单独处理
|
||||
$this->promptData = $data['prompt'] ?? null;
|
||||
unset($data['prompt']);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function afterCreate(): void
|
||||
{
|
||||
// 创建终端后,创建或更新提示词
|
||||
if (!empty($this->promptData['prompt_template'])) {
|
||||
$this->record->prompt()->create([
|
||||
'prompt_template' => $this->promptData['prompt_template'],
|
||||
'variables' => $this->promptData['variables'] ?? [],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
private ?array $promptData = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user