feat: 删除 知识库-终端 关联, 简化 prompt 配置
This commit is contained in:
@@ -131,44 +131,6 @@ class TerminalResource extends Resource
|
||||
->columns(2)
|
||||
->description('配置终端的语音唤醒能力'),
|
||||
|
||||
Forms\Components\Section::make('知识库关联')
|
||||
->schema([
|
||||
Forms\Components\Repeater::make('knowledgeBaseAssociations')
|
||||
->label('关联知识库')
|
||||
->relationship('knowledgeBases')
|
||||
->schema([
|
||||
Forms\Components\Select::make('id')
|
||||
->label('知识库')
|
||||
->options(\App\Models\KnowledgeBase::where('status', 'active')->pluck('name', 'id'))
|
||||
->required()
|
||||
->searchable()
|
||||
->distinct()
|
||||
->disableOptionsWhenSelectedInSiblingRepeaterItems()
|
||||
->helperText('选择要关联的知识库'),
|
||||
|
||||
Forms\Components\TextInput::make('priority')
|
||||
->label('优先级')
|
||||
->numeric()
|
||||
->default(0)
|
||||
->required()
|
||||
->minValue(0)
|
||||
->helperText('数字越小优先级越高,0为最高优先级'),
|
||||
])
|
||||
->columns(2)
|
||||
->reorderable()
|
||||
->reorderableWithButtons()
|
||||
->addActionLabel('添加知识库')
|
||||
->reorderableWithDragAndDrop(false)
|
||||
->itemLabel(
|
||||
fn(array $state): ?string =>
|
||||
\App\Models\KnowledgeBase::find($state['id'])?->name ?? '未选择'
|
||||
)
|
||||
->collapsed()
|
||||
->collapsible()
|
||||
->helperText('可以关联多个知识库,并设置优先级。拖动或使用按钮调整顺序。'),
|
||||
])
|
||||
->description('配置终端可以访问的知识库及其优先级'),
|
||||
|
||||
Forms\Components\Section::make('指引关联')
|
||||
->schema([
|
||||
Forms\Components\Repeater::make('guideAssociations')
|
||||
@@ -215,17 +177,13 @@ class TerminalResource extends Resource
|
||||
->label('提示词模板')
|
||||
->language('markdown')
|
||||
->fontSize('14px')
|
||||
->helperText('编辑AI提示词模板,支持使用变量如 {user}, {station}, {time} 等')
|
||||
->helperText('编辑AI提示词模板,支持使用占位符 {station_id}, {user}, {time}(由HMI端替换)')
|
||||
->placeholderText('请输入AI提示词模板...')
|
||||
->disablePreview()
|
||||
->columnSpan(2),
|
||||
|
||||
Forms\Components\Grid::make(1)
|
||||
->schema([
|
||||
Forms\Components\Placeholder::make('template_selector')
|
||||
->label('模板库')
|
||||
->content(fn() => view('filament.components.prompt-template-selector')),
|
||||
|
||||
Forms\Components\Placeholder::make('variable_helper')
|
||||
->label('变量参考')
|
||||
->content(fn() => view('filament.components.prompt-variable-helper')),
|
||||
@@ -233,7 +191,7 @@ class TerminalResource extends Resource
|
||||
->columnSpan(1),
|
||||
]),
|
||||
])
|
||||
->description('配置终端的AI提示词模板,用于指导AI助手的行为')
|
||||
->description('配置终端的AI提示词模板,占位符由HMI端替换')
|
||||
->collapsible(),
|
||||
|
||||
Forms\Components\Section::make('状态信息')
|
||||
|
||||
Reference in New Issue
Block a user