Skip to content

Commit

Permalink
hotfix for statusText is non ISO-8859-1 ChatGPTNextWeb#5717
Browse files Browse the repository at this point in the history
  • Loading branch information
lloydzhou committed Oct 25, 2024
1 parent 4745706 commit e3ca7e8
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src-tauri/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,20 @@ pub async fn stream_fetch(
}
}
Err(err) => {
println!("Error response: {:?}", err.source().expect("REASON").to_string());
let error: String = err.source().expect("REASON").to_string();
println!("Error response: {:?}", error);
tauri::async_runtime::spawn( async move {
if let Err(e) = window.emit(event_name, ChunkPayload{ request_id, chunk: error.into() }) {
println!("Failed to emit chunk payload: {:?}", e);
}
if let Err(e) = window.emit(event_name, EndPayload{ request_id, status: 0 }) {
println!("Failed to emit end payload: {:?}", e);
}
});
StreamResponse {
request_id,
status: 599,
status_text: err.source().expect("REASON").to_string(),
status_text: "Error".to_string(),
headers: HashMap::new(),
}
}
Expand Down

0 comments on commit e3ca7e8

Please sign in to comment.