fix: align with fastchat mainstream (#670)

Fastchat mainstream change its return format, and text now is only
string in choices structure.

So make this change, to work with mainstream fastchat.

Signed-off-by: Lei Wen <wenlei03@qiyi.com>
Co-authored-by: Lei Wen <wenlei03@qiyi.com>
release-notes-05
leiwen83 2023-10-30 10:31:46 +08:00 committed by GitHub
parent 88d2617a34
commit b47bdd5d77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -20,7 +20,7 @@ struct Response {
#[derive(Deserialize)] #[derive(Deserialize)]
struct Prediction { struct Prediction {
text: Vec<String>, text: String,
} }
pub struct FastChatEngine { pub struct FastChatEngine {
@ -83,7 +83,7 @@ impl TextGeneration for FastChatEngine {
let resp: Response = resp.json().await.expect("Failed to parse response"); let resp: Response = resp.json().await.expect("Failed to parse response");
resp.choices[0].text[0].clone() resp.choices[0].text.clone()
} }
async fn generate_stream( async fn generate_stream(