mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-20 16:08:14 +00:00
refactor: 移除冗余日志记录,优化代码可读性
This commit is contained in:
parent
3a2b7b1400
commit
dd20711c04
@ -158,10 +158,9 @@ class ManticoreBase
|
||||
) charset_table='non_cjk, cjk' morphology='icu_chinese'
|
||||
");
|
||||
|
||||
Log::info('Manticore tables initialized successfully');
|
||||
// Tables initialized successfully
|
||||
} catch (PDOException $e) {
|
||||
Log::warning('Manticore initialization warning: ' . $e->getMessage());
|
||||
// 不抛出异常,表可能已存在
|
||||
// 表可能已存在,忽略初始化错误
|
||||
}
|
||||
}
|
||||
|
||||
@ -2040,8 +2039,7 @@ class ManticoreBase
|
||||
if ($instance->execute($stmt['sql'], $stmt['values'])) {
|
||||
$successCount++;
|
||||
} else {
|
||||
// 插入失败,记录日志(数据已被删除,需要重新同步)
|
||||
Log::warning("Manticore batch update failed for {$table}", ['pk' => $stmt['pk']]);
|
||||
// 插入失败,数据已被删除,需要重新同步
|
||||
}
|
||||
}
|
||||
|
||||
@ -2110,7 +2108,7 @@ class ManticoreBase
|
||||
return $result['data'] ?? [];
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::warning('Get embedding error: ' . $e->getMessage());
|
||||
// embedding 获取失败,返回空数组
|
||||
}
|
||||
|
||||
return [];
|
||||
|
||||
@ -235,7 +235,6 @@ class ManticoreFile
|
||||
// 根据文件类型检查大小限制
|
||||
$maxSize = self::getMaxFileSizeByExt($file->ext);
|
||||
if ($file->size > $maxSize) {
|
||||
Log::info("Manticore: Skip large file {$file->id} ({$file->size} bytes, max: {$maxSize})");
|
||||
// 删除可能存在的旧索引(文件更新后可能超限)
|
||||
self::delete($file->id);
|
||||
return true;
|
||||
@ -546,7 +545,6 @@ class ManticoreFile
|
||||
// 4. 批量获取 embedding
|
||||
$result = AI::getBatchEmbeddings($texts);
|
||||
if (!Base::isSuccess($result) || empty($result['data'])) {
|
||||
Log::warning('ManticoreFile: Batch embedding failed', ['file_ids' => $ids]);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -565,13 +563,6 @@ class ManticoreFile
|
||||
if (!empty($vectorData)) {
|
||||
$batchCount = ManticoreBase::batchUpdateFileVectors($vectorData);
|
||||
$successCount += $batchCount;
|
||||
|
||||
if ($batchCount < count($vectorData)) {
|
||||
Log::warning('ManticoreFile: Some vector updates failed', [
|
||||
'expected' => count($vectorData),
|
||||
'actual' => $batchCount,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -460,10 +460,6 @@ class ManticoreMsg
|
||||
$result = AI::getBatchEmbeddings($texts);
|
||||
|
||||
if (Base::isError($result)) {
|
||||
Log::warning('ManticoreMsg: Batch embedding failed', [
|
||||
'msg_ids' => $idsArray,
|
||||
'error' => $result['msg'] ?? 'Unknown error',
|
||||
]);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -488,13 +484,6 @@ class ManticoreMsg
|
||||
if (!empty($vectorData)) {
|
||||
$batchCount = ManticoreBase::batchUpdateMsgVectors($vectorData);
|
||||
$count += $batchCount;
|
||||
|
||||
if ($batchCount < count($vectorData)) {
|
||||
Log::warning('ManticoreMsg: Some vector updates failed', [
|
||||
'expected' => count($vectorData),
|
||||
'actual' => $batchCount,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -339,7 +339,6 @@ class ManticoreProject
|
||||
// 4. 批量获取 embedding
|
||||
$result = AI::getBatchEmbeddings($texts);
|
||||
if (!Base::isSuccess($result) || empty($result['data'])) {
|
||||
Log::warning('ManticoreProject: Batch embedding failed', ['project_ids' => $ids]);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -358,13 +357,6 @@ class ManticoreProject
|
||||
if (!empty($vectorData)) {
|
||||
$batchCount = ManticoreBase::batchUpdateProjectVectors($vectorData);
|
||||
$successCount += $batchCount;
|
||||
|
||||
if ($batchCount < count($vectorData)) {
|
||||
Log::warning('ManticoreProject: Some vector updates failed', [
|
||||
'expected' => count($vectorData),
|
||||
'actual' => $batchCount,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -144,10 +144,6 @@ class ManticoreTask
|
||||
{
|
||||
// 防止无限递归:深度超过10层或循环引用
|
||||
if ($depth > 10 || in_array($task->id, $visited)) {
|
||||
Log::warning('ManticoreTask: getAllowedUsers recursion limit reached', [
|
||||
'task_id' => $task->id,
|
||||
'depth' => $depth,
|
||||
]);
|
||||
return [];
|
||||
}
|
||||
$visited[] = $task->id;
|
||||
@ -280,7 +276,6 @@ class ManticoreTask
|
||||
// 限制内容长度
|
||||
return mb_substr($text, 0, self::MAX_CONTENT_LENGTH);
|
||||
} catch (\Exception $e) {
|
||||
Log::warning('Get task content error: ' . $e->getMessage(), ['task_id' => $task->id]);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@ -568,7 +563,6 @@ class ManticoreTask
|
||||
// 4. 批量获取 embedding
|
||||
$result = AI::getBatchEmbeddings($texts);
|
||||
if (!Base::isSuccess($result) || empty($result['data'])) {
|
||||
Log::warning('ManticoreTask: Batch embedding failed', ['task_ids' => $ids]);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -587,13 +581,6 @@ class ManticoreTask
|
||||
if (!empty($vectorData)) {
|
||||
$batchCount = ManticoreBase::batchUpdateTaskVectors($vectorData);
|
||||
$successCount += $batchCount;
|
||||
|
||||
if ($batchCount < count($vectorData)) {
|
||||
Log::warning('ManticoreTask: Some vector updates failed', [
|
||||
'expected' => count($vectorData),
|
||||
'actual' => $batchCount,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -331,7 +331,6 @@ class ManticoreUser
|
||||
// 4. 批量获取 embedding
|
||||
$result = AI::getBatchEmbeddings($texts);
|
||||
if (!Base::isSuccess($result) || empty($result['data'])) {
|
||||
Log::warning('ManticoreUser: Batch embedding failed', ['user_ids' => $ids]);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -350,13 +349,6 @@ class ManticoreUser
|
||||
if (!empty($vectorData)) {
|
||||
$batchCount = ManticoreBase::batchUpdateUserVectors($vectorData);
|
||||
$successCount += $batchCount;
|
||||
|
||||
if ($batchCount < count($vectorData)) {
|
||||
Log::warning('ManticoreUser: Some vector updates failed', [
|
||||
'expected' => count($vectorData),
|
||||
'actual' => $batchCount,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user