feat(i18n): add JSON file type support across multiple locales
- Introduced support for JSON file types in English, Korean, Russian, and Chinese locale files. - Updated the file type acceptance criteria in the document upload component to include JSON. - Enhanced the knowledge base parser settings to recognize JSON as a valid file type. - Implemented JSON conversion functionality in the document parser, allowing for JSON content to be processed and converted to markdown. - Added comprehensive tests for JSON to markdown conversion to ensure functionality and reliability.
This commit is contained in:
@@ -15,7 +15,8 @@ import (
|
||||
var simpleFormats = map[string]bool{
|
||||
"md": true, "markdown": true,
|
||||
"txt": true, "text": true,
|
||||
"csv": true,
|
||||
"csv": true,
|
||||
"json": true,
|
||||
}
|
||||
|
||||
var imageFormats = map[string]bool{
|
||||
@@ -56,6 +57,12 @@ func (b *SimpleFormatReader) Read(_ context.Context, req *types.ReadRequest) (*t
|
||||
return nil, fmt.Errorf("csv conversion failed: %w", err)
|
||||
}
|
||||
return &types.ReadResult{MarkdownContent: md}, nil
|
||||
case ft == "json":
|
||||
md, err := jsonToMarkdown(req.FileContent)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("json conversion failed: %w", err)
|
||||
}
|
||||
return &types.ReadResult{MarkdownContent: md}, nil
|
||||
case imageFormats[ft]:
|
||||
return imageToResult(req.FileName, req.FileContent), nil
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user