Fixed extractFileContent missing.

This commit is contained in:
hujunqing
2025-12-02 16:32:10 +08:00
committed by sunhao
parent 68dcd89267
commit 4de8ccd788
+21
View File
@@ -691,6 +691,27 @@ class zaiModel extends model
return $filteredKnowledges;
}
/**
* 提取文件内容。
* Extract file content.
*
* @access public
* @param int $fileID
* @return array
*/
public function extractFileContent(int $fileID): array|null
{
$file = $this->loadModel('file')->getByID($fileID);
if(!is_object($file) || empty($file->realPath)) return null;
$filePath = $file->realPath;
$cFile = new CURLFile($filePath, null, $file->title);
$result = $this->callAdminAPI('/v8/files/extract', 'POST', null, ['file' => $cFile]);
if($result['result'] != 'success') return null;
return $result['data'];
}
/**
* 用户对象可查看缓存配置。
* User object view cache configuration.