mirror of
https://github.com/QuotifyTeam/QuotifyBE.git
synced 2025-12-15 08:30:06 +01:00
Compare commits
2 Commits
8a8aac77da
...
870fcf7573
| Author | SHA1 | Date | |
|---|---|---|---|
| 870fcf7573 | |||
| e9b36b5d49 |
@@ -233,7 +233,12 @@ public class GeneralUseHelpers(ApplicationDbContext db, IConfiguration appsettin
|
||||
else
|
||||
{
|
||||
// Handle the error
|
||||
JObject error = JObject.Parse(await response.Content.ReadAsStringAsync());
|
||||
Console.WriteLine($"[QuotifyBE] Error: response status code from API was {response.StatusCode}.");
|
||||
if (error != null && error["error"] != null && error["error"]!["message"] != null)
|
||||
{
|
||||
Console.WriteLine($" Error message: {error["error"]!["message"]}");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,11 +20,13 @@ public class QuotesController : ControllerBase
|
||||
|
||||
private readonly ApplicationDbContext _db;
|
||||
private readonly GeneralUseHelpers guhf;
|
||||
private readonly IConfiguration _appsettings;
|
||||
|
||||
public QuotesController(ApplicationDbContext db, GeneralUseHelpers GUHF)
|
||||
public QuotesController(ApplicationDbContext db, GeneralUseHelpers GUHF, IConfiguration appsettings)
|
||||
{
|
||||
_db = db;
|
||||
guhf = GUHF;
|
||||
_appsettings = appsettings;
|
||||
}
|
||||
|
||||
// GET /api/v1/quotes
|
||||
@@ -535,6 +537,8 @@ public class QuotesController : ControllerBase
|
||||
request.CustomPrompt, request.Model, request.Temperature, request.CategoryId, request.UseSampleQuote
|
||||
);
|
||||
|
||||
string llmUsed = request.Model ?? _appsettings.GetSection("LlmIntegration")["DefaultModel"] ?? "deepclaude";
|
||||
|
||||
// Check if any errors occurred
|
||||
if (generatedResponse == null)
|
||||
{
|
||||
@@ -549,7 +553,7 @@ public class QuotesController : ControllerBase
|
||||
return StatusCode(500, new ErrorDTO { Status = "error", Error_msg = "Unexpected API response" });
|
||||
|
||||
// Otherwise, return the response
|
||||
return Ok(new { Status = "ok", BotResponse = llmResponse });
|
||||
return Ok(new { Status = "ok", BotResponse = llmResponse, Model = llmUsed });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user