Skip to content

fix: improve response handling by using a temporary file for markdown… - #14

Merged
Abourass merged 2 commits into
mainfrom
Hot-Fix-For-Ask
Nov 19, 2025
Merged

fix: improve response handling by using a temporary file for markdown…#14
Abourass merged 2 commits into
mainfrom
Hot-Fix-For-Ask

Conversation

@Abourass

Copy link
Copy Markdown
Member

This pull request refactors how the ask function in functions/ask.fish handles and stores AI responses. Instead of accumulating the response in a variable, it now streams the output to a temporary file, improving memory usage and reliability when handling large or streamed responses. The temporary file is cleaned up after use.

Response handling improvements:

  • Streams each chunk of the AI response directly to a temporary file (response_file) instead of appending to the response_text variable, which is more efficient for large responses.
  • Reads the full response from the temporary file into response_text after streaming, ensuring the complete response is available for further processing.

Resource management:

  • Creates a temporary file at the start of the function to store the response and removes it at the end to prevent resource leaks. [1] [2]

@Abourass Abourass self-assigned this Nov 19, 2025
@Abourass
Abourass merged commit 4383913 into main Nov 19, 2025
4 of 6 checks passed
@Abourass
Abourass deleted the Hot-Fix-For-Ask branch November 19, 2025 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant