mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-03 13:38:00 +00:00
@@ -4,7 +4,7 @@ import { readFileRawText } from './rawText';
|
||||
|
||||
// 加载源文件内容
|
||||
export const readCsvRawText = async (params: ReadRawTextByBuffer): Promise<ReadFileResponse> => {
|
||||
const { rawText } = readFileRawText(params);
|
||||
const { rawText } = await readFileRawText(params);
|
||||
|
||||
const csvArr = Papa.parse(rawText).data as string[][];
|
||||
|
||||
|
@@ -3,7 +3,7 @@ import { readFileRawText } from './rawText';
|
||||
import { html2md } from '../../htmlStr2Md/utils';
|
||||
|
||||
export const readHtmlRawText = async (params: ReadRawTextByBuffer): Promise<ReadFileResponse> => {
|
||||
const { rawText: html } = readFileRawText(params);
|
||||
const { rawText: html } = await readFileRawText(params);
|
||||
|
||||
const { rawText, imageList } = html2md(html);
|
||||
|
||||
|
@@ -18,7 +18,10 @@ const rawEncodingList = [
|
||||
];
|
||||
|
||||
// 加载源文件内容
|
||||
export const readFileRawText = ({ buffer, encoding }: ReadRawTextByBuffer): ReadFileResponse => {
|
||||
export const readFileRawText = async ({
|
||||
buffer,
|
||||
encoding
|
||||
}: ReadRawTextByBuffer): Promise<ReadFileResponse> => {
|
||||
const content = (() => {
|
||||
try {
|
||||
if (rawEncodingList.includes(encoding)) {
|
||||
|
Reference in New Issue
Block a user