feat: 删除 知识库-终端 关联, 简化 prompt 配置

This commit is contained in:
2026-03-23 15:27:06 +08:00
parent 81a22a2b54
commit 89af7c17f1
23 changed files with 102 additions and 1633 deletions

View File

@@ -21,19 +21,6 @@ class KnowledgeBase extends Model
'status',
];
/**
* 获取关联的终端
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function terminals()
{
return $this->belongsToMany(Terminal::class, 'terminal_knowledge_bases')
->withPivot('priority')
->withTimestamps()
->orderBy('priority');
}
/**
* 获取知识库下的文档
*

View File

@@ -46,19 +46,6 @@ class Terminal extends Model
];
}
/**
* 获取终端关联的知识库
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function knowledgeBases()
{
return $this->belongsToMany(KnowledgeBase::class, 'terminal_knowledge_bases')
->withPivot('priority')
->withTimestamps()
->orderBy('priority');
}
/**
* 获取终端关联的指引
*

View File

@@ -1,52 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class TerminalKnowledgeBase extends Model
{
/**
* 可批量赋值的属性
*
* @var array<string>
*/
protected $fillable = [
'terminal_id',
'knowledge_base_id',
'priority',
];
/**
* 属性类型转换
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'priority' => 'integer',
];
}
/**
* 获取关联的终端
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function terminal(): BelongsTo
{
return $this->belongsTo(Terminal::class);
}
/**
* 获取关联的知识库
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function knowledgeBase(): BelongsTo
{
return $this->belongsTo(KnowledgeBase::class);
}
}