MCPcopy Create free account
hub / github.com/TaskingAI/TaskingAI / fetchHistoryMessage

Function fetchHistoryMessage

frontend/src/components/playground/index.tsx:385–405  ·  view source on GitHub ↗
(assistantId: string, chatId: string, param: any)

Source from the content-addressed store, hash-verified

383
384 }
385 const fetchHistoryMessage = async (assistantId: string, chatId: string, param: any) => {
386 if (param.after) {
387 setShouldSmoothScroll(false)
388 } else {
389 setShouldSmoothScroll(true)
390 }
391 try {
392 const res: any = await getHistoryMessage(assistantId, chatId, param)
393 const data = res.data.reverse()
394 setContentHasMore(res.has_more)
395 const contentTalk1: any = localStorage.getItem('contentTalk')
396 localStorage.setItem('contentHasMore', JSON.stringify(res.has_more))
397 localStorage.setItem('contentTalk', JSON.stringify([...data, ...JSON.parse(contentTalk1)]) as any)
398 setContentTalk(prevValues => [...data, ...prevValues])
399 } catch (error) {
400 const apiError = error as ApiErrorResponse;
401 const errorMessage: string = apiError.response.data.error.message;
402 toast.error(errorMessage)
403 }
404
405 }
406 const handleSelectAssistantID = () => {
407 if (assistantId) {
408 const id = assistantId[0].split('-')[1] ? assistantId[0].split('-')[1] : assistantId[0]

Callers 3

handleOpenChatFunction · 0.85
handleContentLodaMoreFunction · 0.85
onDeleteConfirmFunction · 0.85

Calls 1

getHistoryMessageFunction · 0.90

Tested by

no test coverage detected