MCPcopy Create free account
hub / github.com/ResearAI/AutoFigure / sendChatMessage

Function sendChatMessage

frontend/components/chat-panel.tsx:814–845  ·  view source on GitHub ↗
(
        parts: any,
        xml: string,
        previousXml: string,
        sessionId: string,
    )

Source from the content-addressed store, hash-verified

812
813 // Send chat message with headers and increment quota
814 const sendChatMessage = (
815 parts: any,
816 xml: string,
817 previousXml: string,
818 sessionId: string,
819 ) => {
820 // Reset auto-retry count on user-initiated message
821 autoRetryCountRef.current = 0
822
823 const config = getAIConfig()
824
825 sendMessage(
826 { parts },
827 {
828 body: { xml, previousXml, sessionId },
829 headers: {
830 "x-access-code": config.accessCode,
831 ...(config.aiProvider && {
832 "x-ai-provider": config.aiProvider,
833 ...(config.aiBaseUrl && {
834 "x-ai-base-url": config.aiBaseUrl,
835 }),
836 ...(config.aiApiKey && {
837 "x-ai-api-key": config.aiApiKey,
838 }),
839 ...(config.aiModel && { "x-ai-model": config.aiModel }),
840 }),
841 },
842 },
843 )
844 quotaManager.incrementRequestCount()
845 }
846
847 // Process files and append content to user text (handles PDF, text, and optionally images)
848 const processFilesAndAppendContent = async (

Callers 3

onFormSubmitFunction · 0.85
handleRegenerateFunction · 0.85
handleEditMessageFunction · 0.85

Calls 1

getAIConfigFunction · 0.90

Tested by

no test coverage detected