Download ragflow-main/web/src/pages/add-knowledge/components/knowledge-chunk/utils.ts from pandaall/ragflow: direct link, hf CLI and curl.
- Browser
- Download file 531 Bytes
-
https://huggingface.co/datasets/pandaall/ragflow/resolve/main/ragflow-main/web/src/pages/add-knowledge/components/knowledge-chunk/utils.ts
- Command line
-
hf download hf://datasets/pandaall/ragflow/ragflow-main/web/src/pages/add-knowledge/components/knowledge-chunk/utils.ts
-
curl -L -o utils.ts https://huggingface.co/datasets/pandaall/ragflow/resolve/main/ragflow-main/web/src/pages/add-knowledge/components/knowledge-chunk/utils.ts
531 Bytes
| export type FormListItem = { | |
| frequency: number; | |
| tag: string; | |
| }; | |
| export function transformTagFeaturesArrayToObject( | |
| list: Array<FormListItem> = [], | |
| ) { | |
| return list.reduce<Record<string, number>>((pre, cur) => { | |
| pre[cur.tag] = cur.frequency; | |
| return pre; | |
| }, {}); | |
| } | |
| export function transformTagFeaturesObjectToArray( | |
| object: Record<string, number> = {}, | |
| ) { | |
| return Object.keys(object).reduce<Array<FormListItem>>((pre, key) => { | |
| pre.push({ frequency: object[key], tag: key }); | |
| return pre; | |
| }, []); | |
| } | |