| 769 | } |
| 770 | |
| 771 | static std::string IsoTimestamp() { |
| 772 | auto now = std::chrono::system_clock::now(); |
| 773 | auto tt = std::chrono::system_clock::to_time_t(now); |
| 774 | auto ms = std::chrono::duration_cast<std::chrono::milliseconds>( |
| 775 | now.time_since_epoch()) % 1000; |
| 776 | struct tm tm_buf; |
| 777 | localtime_s(&tm_buf, &tt); |
| 778 | char buf[32]; |
| 779 | snprintf(buf, sizeof(buf), "%04d-%02d-%02dT%02d:%02d:%02d.%03d", |
| 780 | tm_buf.tm_year + 1900, tm_buf.tm_mon + 1, tm_buf.tm_mday, |
| 781 | tm_buf.tm_hour, tm_buf.tm_min, tm_buf.tm_sec, |
| 782 | static_cast<int>(ms.count())); |
| 783 | return buf; |
| 784 | } |
| 785 | |
| 786 | // Extract assistant content from SSE stream (concatenate all delta content pieces). |
| 787 | static std::string ExtractSseContent(const std::string& sse_raw) { |