File tree Expand file tree Collapse file tree 1 file changed +3
-24
lines changed Expand file tree Collapse file tree 1 file changed +3
-24
lines changed Original file line number Diff line number Diff line change @@ -561,32 +561,11 @@ app.get("/api/properties/:id", async (c: Context) => {
561
561
` ,
562
562
} ) ;
563
563
564
- const propertyData = property . rows [ 0 ] as any ;
565
-
566
- if ( query . regenerate_ai_description === "true" ) {
567
- if ( propertyData . ai_generated_description ) {
568
- // Reset the ai_generated_description to null if it exists
569
- propertyData . ai_generated_description = null ;
570
- }
571
-
572
- const aiGeneratedDescription = await openaiAssistant ( JSON . stringify ( propertyData ) ) ;
573
-
574
- try {
575
- // Verify the aiDescription is valid JSON by parsing it
576
- JSON . parse ( aiGeneratedDescription . includes ( "```json" ) ? aiGeneratedDescription . replace ( "```json" , "" ) . replace ( "```" , "" ) : aiGeneratedDescription ) ;
577
-
578
- propertyData . ai_generated_description = aiGeneratedDescription ;
579
-
580
- await client . queryObject ( {
581
- args : [ propertyData . id , JSON . stringify ( aiGeneratedDescription ) ] ,
582
- text : `UPDATE Property SET ai_generated_description = $2 WHERE id = $1` ,
583
- } ) ;
584
- } catch ( error ) {
585
- console . error ( "Invalid AI description format:" , error ) ;
586
- }
564
+ if ( property . rowCount === 0 ) {
565
+ return c . json ( { data : null } ) ;
587
566
}
588
567
589
- return c . json ( { data : propertyData } ) ;
568
+ return c . json ( { data : property . rows [ 0 ] } ) ;
590
569
} ) ;
591
570
592
571
app . post ( "/" , async ( c : Context ) => {
You can’t perform that action at this time.
0 commit comments