chore: disable pdf option (#719)

* chore: disable pdf option

* chore: reanme
This commit is contained in:
Nathan.fooo 2024-08-08 23:56:33 +08:00 committed by GitHub
parent 0b3949152b
commit d27a0cf204
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 7 deletions

View File

@ -298,8 +298,17 @@ impl QuestionStream {
}
pub enum QuestionStreamValue {
Answer { value: String },
Metadata { value: serde_json::Value },
Answer {
value: String,
},
/// Metadata is a JSON array object. its structure as below:
/// ```json
/// [
/// {"id": "xx", "source": "", "name": "" }
/// ]
Metadata {
value: serde_json::Value,
},
}
impl Stream for QuestionStream {
type Item = Result<QuestionStreamValue, AppResponseError>;

View File

@ -682,7 +682,8 @@ impl ChatMetadataData {
match self.content_type {
ChatMetadataContentType::Text => self.content.len() == self.size as usize,
ChatMetadataContentType::Markdown => self.content.len() == self.size as usize,
_ => true,
ChatMetadataContentType::Unknown => false,
ChatMetadataContentType::PDF => false,
}
}
}
@ -692,8 +693,7 @@ pub enum ChatMetadataContentType {
Unknown,
Text,
Markdown,
Pdf,
Custom(String),
PDF,
}
impl Display for ChatMetadataContentType {
@ -702,8 +702,7 @@ impl Display for ChatMetadataContentType {
ChatMetadataContentType::Unknown => write!(f, "unknown"),
ChatMetadataContentType::Text => write!(f, "txt"),
ChatMetadataContentType::Markdown => write!(f, "markdown"),
ChatMetadataContentType::Pdf => write!(f, "pdf"),
ChatMetadataContentType::Custom(custom) => write!(f, "{}", custom),
ChatMetadataContentType::PDF => write!(f, "pdf"),
}
}
}