mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-03 07:37:05 +00:00
refactor: 移除缓存写入逻辑并简化未获取向量填充过程
This commit is contained in:
parent
425f7b6f79
commit
f821e5ad28
@ -943,18 +943,13 @@ class AI
|
||||
|
||||
if (!empty($embedding) && is_array($embedding)) {
|
||||
$results[$originalIndex] = $embedding;
|
||||
|
||||
// 写入缓存
|
||||
$text = $uncachedTexts[$itemIndex];
|
||||
$cacheKey = "openAIEmbedding::" . md5($text);
|
||||
Cache::put($cacheKey, Base::retSuccess("success", $embedding), Carbon::now()->addDays(7));
|
||||
} else {
|
||||
$results[$originalIndex] = [];
|
||||
}
|
||||
}
|
||||
|
||||
// 填充未获取到向量的位置
|
||||
foreach ($uncachedIndices as $i => $originalIndex) {
|
||||
foreach ($uncachedIndices as $originalIndex) {
|
||||
if (!isset($results[$originalIndex])) {
|
||||
$results[$originalIndex] = [];
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user