Skip to content

Commit

Permalink
Update save of new generated summaries [WEB-2934]
Browse files Browse the repository at this point in the history
  • Loading branch information
web-dev-trev committed Dec 20, 2024
1 parent 318a766 commit d85d922
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion app/Console/Commands/AI/UseCompletions.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,23 @@ protected function generateNewSummary(
$imageEmbedding->data['description_generation_data']['analysis_data']
);

// Update or create text embedding with new summary
// Save to both image and text embeddings
$imageData = $imageEmbedding->data;
$imageData['description'] = $newSummary;
$imageData['generated_at'] = now()->toDateTimeString();

// Convert Vector to array for image embedding
$embeddingArray = $imageEmbedding->embedding ? $imageEmbedding->embedding->toArray() : [];

$this->embeddingService->saveEmbeddings(
modelName: "artworks",
modelId: $artwork->id,
embedding: $embeddingArray,
type: 'image',
additionalData: $imageData
);

// Update or create text embedding
$this->embeddingService->saveEmbeddings(
modelName: "artworks",
modelId: $artwork->id,
Expand Down

0 comments on commit d85d922

Please sign in to comment.