mumu-lhl / duckduckgo-ai-chat-service

Use Duckduckgo AI Chat to provide an OpenAI-compatible API that can be used for free with gpt-4o-mini.
MIT License
10 stars 10 forks source link

refactor: error handling and connection management #1

Closed lequan2909 closed 1 month ago

lequan2909 commented 1 month ago

Changes Made End Message Check: Added a condition to check if event.data is "[DONE]" to terminate the loop. Error Handling: Implemented a try-catch block when parsing responses from the API to prevent the program from crashing on errors. Connection Management Improvement: Ensured that parameters and responses from the API are handled safely. Conclusion With these adjustments, your code will run more reliably and handle invalid messages better.

lequan2909 commented 1 month ago

support modem

mumu-lhl commented 1 month ago

LGTM :+1: But can you translate the comments into English?

mumu-lhl commented 1 month ago

Thank you :)