Skip to content

Commit

Permalink
fix: Correct JSON parsing for aiGeneratedDescription strings
Browse files Browse the repository at this point in the history
  • Loading branch information
csulit committed Oct 25, 2024
1 parent a2210c8 commit 93c9d80
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/deno-kv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ export async function listenQueue(kv: Deno.Kv) {
);

try {
JSON.parse(aiGeneratedDescription);
JSON.parse(aiGeneratedDescription.replace("```", "```json"));
} catch {
throw Error("Invalid AI description format");
}
Expand Down
2 changes: 1 addition & 1 deletion server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ app.get("/api/properties/:id", async (c: Context) => {

try {
// Verify the aiDescription is valid JSON by parsing it
JSON.parse(aiDescription);
JSON.parse(aiDescription.replace("```", "```json"));

propertyData.ai_generated_description = aiDescription;

Expand Down

0 comments on commit 93c9d80

Please sign in to comment.