Skip to content

Commit

Permalink
Fix caption (#4)
Browse files Browse the repository at this point in the history
* refactor: Set caption to enhancedPrompt in HandleCommand

* fix: Ensure caption length is within Telegram limits

* meme bot v0.1.34
  • Loading branch information
azalio authored Dec 31, 2024
1 parent b6e63b5 commit 7eb5bdd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/service/prompt_enhancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ func (p *PromptEnhancer) EnhancePrompt(ctx context.Context, originalPrompt strin
return originalPrompt, "", fmt.Errorf("enhancing prompt: %w", err)
}

if caption == "" {
caption = originalPrompt
}

// Ensure caption length is within Telegram limits
if len(caption) > 1024 {
caption = caption[:1024]
}

p.logger.Debug(ctx, "Successfully enhanced prompt", map[string]interface{}{
"original_prompt": originalPrompt,
"enhanced_prompt": enhancedPrompt,
Expand Down

0 comments on commit 7eb5bdd

Please sign in to comment.