Skip to content

Commit

Permalink
Update ollamaService.js to return the entire json object
Browse files Browse the repository at this point in the history
Update ollamaService.js to return the entire json object instead of just the tags and correspondent.
  • Loading branch information
voxibanez authored Jan 8, 2025
1 parent 107b6b7 commit dd21a15
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions services/ollamaService.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ class OllamaService {
// Try to parse the extracted JSON
const result = JSON.parse(jsonStr);

// Validate and return structured data
return {
tags: Array.isArray(result.tags) ? result.tags : [],
correspondent: typeof result.correspondent === 'string' ? result.correspondent : null
};
// Validate structured data
result.tags = Array.isArray(result.tags) ? result.tags : []; // Ensure tags is an array
result.correspondent = typeof result.correspondent === 'string' ? result.correspondent : null; // Ensure correspondent is a string

return result;
} catch (error) {
console.error('Error parsing Ollama response:', error);
console.error('Raw response:', response);
Expand All @@ -92,4 +92,4 @@ class OllamaService {
}
}

module.exports = new OllamaService();
module.exports = new OllamaService();

0 comments on commit dd21a15

Please sign in to comment.