Detailed breakdown of client and server functions involved in sending prompts to AI models
1. handleAIApiType(fileMetadata)
doc
, custom_gpt
, canvas
) used to route the request to the correct backend function.2. handleSubmitPrompt(refine = false)
3. enterNewPrompt()
handleAIApiType
.Usage:4. Common Payload Structure (LLM API)
5. Python Backend API Functions
getPerplexityResponse(payload)
prompt_id
, companyId
, provider
, code
getAINormatChatResponse(payload)
custom_gpt_id
, img_url
, companyId
, provider
, code
getAIDocResponse(payload)
custom_gpt_id
, companyId
, provider
, code
getAICustomGPTResponse(payload)
agent.model_name
instead of the selected model namecustom_gpt_id
, companyId
, provider
, code
chatCanvasAiResponse(payload)
currentMessageId
, startIndex
, endIndex
, custom_gpt_id
, companyId
, provider
, code
getAIProAgentChatResponse(payload)
agent_extra_info
getSeoKeyWords(payload)
getSalesCallResponse(payload)
setChatTitleByAI(params)
modelId
, chatId
, code
, messageId
, provider
, model_name
, companyId
6. Hooks Description
useThunderBoltPopup()
useMediaUpload()
chatCanvasAiResponse
.useConversation()
useCustomGpt()
usePrompt()
useBrainDocs()
7. Utility Functions
handleModelSelectionUrl()
blockProAgentAction()
handleProAgentUrlState()
handleNewChatClick()
8. UI Components
CommonList
useBrainDocs
)RenderModalList
9. Utility Hooks
useIntersectionObserver()
useDebounce()
useServerAction()
commonApi()
serverApi()
ValidationError
Prompt doesn't reach backend
handleSubmitPrompt()
is triggeredenterNewPrompt()
runs before submissionhandleAIApiType()
returns the correct typeCustom GPT is not responding correctly
getAICustomGPTResponse()
uses agent.model_name
Pro Agent input not disabled
blockProAgentAction()
is called before invoking getAIProAgentChatResponse()