gemini/fix/llm-retries #50

Merged
eleith merged 4 commits from gemini/fix/llm-retries into main 2025-08-19 19:01:27 +00:00
Owner
  1. add retry logic to deal with model overloaded error responses
  2. consolidate template funcs to funcs.go
  3. add textToHtml template function to handle llm summary
1. add retry logic to deal with model overloaded error responses 2. consolidate template funcs to funcs.go 3. add textToHtml template function to handle llm summary
eleith added 3 commits 2025-08-19 18:55:56 +00:00
Implements a retry mechanism for when the LLM service returns a 503 "overloaded" error.

The changes include:
- Retrying the API call up to two times (three attempts total).
- A backoff delay that increases with each retry.
- Specific error checking for `*genai.APIError` with a 503 status code and "overloaded" message.
- Logging of LLM API errors to aid in future debugging.
Adds a template function to convert newline characters in the digest summary to HTML `<br>` tags, preserving the intended formatting.

The new `nl2br` function also ensures the summary content is HTML-escaped to prevent XSS vulnerabilities.
- Moves the `htmlEscape` function from `templates.go` to `funcs.go` to centralize all template functions.
- Renames `nl2br` to `textToHTML` for clarity.
- Updates the templates to use the new function name.
eleith added 1 commit 2025-08-19 19:00:25 +00:00
- Extracts the LLM API call retry logic into a private `generateContentWithRetry` method for improved readability and separation of concerns.
- Defines a `maxRetries` constant for the retry limit.
eleith merged commit db1242d340 into main 2025-08-19 19:01:27 +00:00
eleith deleted branch gemini/fix/llm-retries 2025-08-19 19:01:27 +00:00
eleith referenced this issue from a commit 2025-08-19 19:01:28 +00:00
eleith referenced this issue from a commit 2025-12-10 22:24:46 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: eleith/miniflux-digest#50