MCPcopy Index your code
hub / github.com/TaskingAI/TaskingAI / getRecordsList

Function getRecordsList

frontend/src/axios/chunk.ts:3–21  ·  view source on GitHub ↗
(collectionId: string, params: T)

Source from the content-addressed store, hash-verified

1import { request } from '../utils/index'
2
3const getRecordsList = async <T extends Record<string, string>>(collectionId: string, params: T) => {
4 const project_base_url = `api/v1`
5 const data = params
6 let str = ''
7 if (data.hasOwnProperty('name_search')) {
8 str += `prefix_filter={"name":"${data.name_search}"}&`
9 delete data.name_search
10 } else if (data.hasOwnProperty('id_search')) {
11 str += `prefix_filter={"chunk_id":"${data.id_search}"}&`
12 delete data.id_search
13 }
14 if (data) {
15 Object.keys(data).forEach(key => {
16 str += `${key}=${data[key]}&`
17 })
18 str = str.substring(0, str.length - 1)
19 }
20 return await request.get(`${project_base_url}/collections/${collectionId}/chunks?${str}`)
21}
22const createRecord = async (collectionId: string, params: object) => {
23 const project_base_url = `api/v1`
24 return await request.post(`${project_base_url}/collections/${collectionId}/chunks`, params)

Callers 2

fetchDataFunction · 0.90
fetchDataFunction · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected