feat: Enhance Manticore integration and AI model support

- Added support for specifying vector dimensions in AI payloads for compatible vendors.
- Updated default AI model from 'text-embedding-ada-002' to 'text-embedding-3-small'.
- Refactored ManticoreBase to bind parameters explicitly for PDO statements, improving type handling.
- Adjusted SQL queries across Manticore modules to remove content previews and ensure inline vector values.
- Updated content preview handling in ManticoreFile, ManticoreProject, ManticoreTask, and ManticoreUser to use substrings for better data management.
This commit is contained in:
kuaifan
2026-01-01 08:59:54 +00:00
parent 48ef4cfdef
commit fdf5ceeaab
6 changed files with 74 additions and 48 deletions

View File

@@ -774,6 +774,14 @@ class AI
"model" => $provider['model'],
"input" => $text,
];
// 统一向量维度为 1536与 Manticore 配置一致)
// OpenAI、智谱等支持 dimensions 参数的厂商需要显式指定
$supportsDimensions = in_array($provider['vendor'], ['openai', 'zhipu']);
if ($supportsDimensions) {
$payload['dimensions'] = 1536;
}
$post = json_encode($payload);
$ai = new self($post);
@@ -827,14 +835,13 @@ class AI
return [
'vendor' => 'openai',
'model' => 'text-embedding-ada-002',
'model' => 'text-embedding-3-small',
'api_key' => $key,
'base_url' => rtrim($baseUrl, '/'),
'agency' => $agency,
];
}
// 各厂商的默认 baseUrl 和 embedding 模型
$vendorDefaults = [
'deepseek' => [
'base_url' => 'https://api.deepseek.com',
@@ -842,11 +849,7 @@ class AI
],
'zhipu' => [
'base_url' => 'https://open.bigmodel.cn/api/paas/v4',
'model' => 'embedding-2',
],
'qianwen' => [
'base_url' => 'https://dashscope.aliyuncs.com/compatible-mode/v1',
'model' => 'text-embedding-v3',
'model' => 'embedding-3',
],
];