How to Implement ChatGPT-like Character-by-Character Streaming Output in Scriptcase (AI API Integration)?

We are developing a Scriptcase-based application that integrates AI APIs (e.g., DeepSeek/OpenAI) and requires a ChatGPT-like character-by-character streaming effect (text appears progressively instead of all at once). We face the following challenges and would appreciate insights from the community:

  1. Frontend Dynamic Rendering

How to implement character-by-character display in Scriptcase’s web interface? Is this achievable purely via JavaScript, or can Scriptcase’s native features be leveraged?
Are there recommended frontend libraries/code patterns (e.g., Typed.js for animation vs. SSE/WebSocket for real streaming)?

  1. Streaming API Integration

For AI APIs supporting streaming responses (e.g., stream: true), how to properly handle chunked data in the backend (PHP) and relay it to the frontend?
Are there successful cases using Scriptcase’s AJAX features or custom PHP scripts for streaming?

  1. Scriptcase Compatibility

Does Scriptcase natively support Server-Sent Events (SSE) or WebSocket? If not, what workarounds exist?

  1. Performance & Stability

How to ensure smooth rendering for long responses (>1000 characters)? Is a chunk buffering mechanism required?
Are there known limitations for streaming implementations in Scriptcase under high concurrency?