mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00

* model config * feat: normalization embedding * perf: share page error circulation * perf: request quantity * perf: share chat toast * perf: queue
17 lines
321 B
TypeScript
17 lines
321 B
TypeScript
import Papa from 'papaparse';
|
|
|
|
export const parseCsvTable2Chunks = (rawText: string) => {
|
|
const csvArr = Papa.parse(rawText).data as string[][];
|
|
|
|
const chunks = csvArr
|
|
.map((item) => ({
|
|
q: item[0] || '',
|
|
a: item[1] || ''
|
|
}))
|
|
.filter((item) => item.q || item.a);
|
|
|
|
return {
|
|
chunks
|
|
};
|
|
};
|