mirror of
				https://github.com/freeedcom/ai-codereviewer.git
				synced 2025-10-31 06:00:53 +00:00 
			
		
		
		
	return empty array for parsing
This commit is contained in:
		
					parent
					
						
							
								626621db03
							
						
					
				
			
			
				commit
				
					
						bcec1128c8
					
				
			
		
					 3 changed files with 5 additions and 3 deletions
				
			
		
							
								
								
									
										4
									
								
								dist/index.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								dist/index.js
									
										
									
									
										vendored
									
									
								
							|  | @ -148,7 +148,9 @@ function getAIResponse(prompt) { | |||
|                         content: prompt, | ||||
|                     }, | ||||
|                 ] })); | ||||
|             const res = ((_b = (_a = response.data.choices[0].message) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.trim()) || ""; | ||||
|             const res = ((_b = (_a = response.data.choices[0].message) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.trim()) || "[]"; | ||||
|             console.log("AI Response:"); | ||||
|             console.log(res); | ||||
|             return JSON.parse(res); | ||||
|         } | ||||
|         catch (error) { | ||||
|  |  | |||
							
								
								
									
										2
									
								
								dist/index.js.map
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js.map
									
										
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							|  | @ -130,7 +130,7 @@ async function getAIResponse(prompt: string): Promise<Array<{ | |||
|       ], | ||||
|     }); | ||||
| 
 | ||||
|     const res = response.data.choices[0].message?.content?.trim() || ""; | ||||
|     const res = response.data.choices[0].message?.content?.trim() || "[]"; | ||||
|     return JSON.parse(res); | ||||
|   } catch (error) { | ||||
|     console.error("Error:", error); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue