mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
reverted error tracing
This commit is contained in:
@@ -1185,14 +1185,6 @@ App::error()
|
||||
$trace = $error->getTrace();
|
||||
$trace = $error->getTrace();
|
||||
|
||||
foreach (array_slice($trace, 0, 100) as $index => $traceEntry) {
|
||||
$file = isset($traceEntry['file']) ? $traceEntry['file'] : '[internal function]';
|
||||
$line = isset($traceEntry['line']) ? $traceEntry['line'] : '';
|
||||
$function = isset($traceEntry['function']) ? $traceEntry['function'] : '';
|
||||
Console::error("[$index] $file : $line -> $function()");
|
||||
}
|
||||
|
||||
|
||||
if (php_sapi_name() === 'cli') {
|
||||
Console::error('[Error] Timestamp: ' . date('c', time()));
|
||||
|
||||
|
||||
+7
-8
@@ -105,11 +105,11 @@ class Create extends CreateDocumentAction
|
||||
|
||||
// Validate and process each document
|
||||
$availableModels = [];
|
||||
if (method_exists($embeddingAgent, 'getAdapter') && method_exists($embeddingAgent->getAdapter(), 'getModels')) {
|
||||
$availableModels = $embeddingAgent->getAdapter()->getModels();
|
||||
}
|
||||
$availableModels = $embeddingAgent->getAdapter()->getModels();
|
||||
|
||||
$results = [];
|
||||
|
||||
// validating all documents first
|
||||
foreach ($documents as $index => $item) {
|
||||
if (!\is_array($item)) {
|
||||
throw new Exception(Exception::DOCUMENT_INVALID_STRUCTURE, 'Invalid item at index ' . $index);
|
||||
@@ -127,10 +127,9 @@ class Create extends CreateDocumentAction
|
||||
if (!empty($availableModels) && !\in_array($model, $availableModels, true)) {
|
||||
throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Unknown embedding model: ' . $model);
|
||||
}
|
||||
|
||||
if (method_exists($embeddingAgent, 'getAdapter') && method_exists($embeddingAgent->getAdapter(), 'setModel')) {
|
||||
$embeddingAgent->getAdapter()->setModel($model);
|
||||
}
|
||||
}
|
||||
foreach ($documents as $index => $item) {
|
||||
$embeddingAgent->getAdapter()->setModel($model);
|
||||
|
||||
$embedResult = $embeddingAgent->embed($text);
|
||||
$vector = $embedResult['embedding'] ?? [];
|
||||
@@ -141,8 +140,8 @@ class Create extends CreateDocumentAction
|
||||
'dimensions' => $dimensions,
|
||||
'embeddings' => $vector,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
$list = new Document([
|
||||
'embeddings' => array_map(fn ($d) => $d, $results),
|
||||
'total' => \count($results),
|
||||
|
||||
Reference in New Issue
Block a user