Building the main function for x-bot
Based on the nickname prefix.
If judged, x-bot-related logic waits to be triggered
X-bot entry:
Current time (mspt-stamp)
x-bot:
Remove Memory Sheet
Put memory forms, new messages, prompt in context. Request a large model.
The model returns the content array first to check for updates
If the query is more than five seconds longer than the previous reference, depositing messages that have not been sent into x-profile-bot-gen data tables pending_messages (string array), and then stopping cloud functions
Send the first message if less than or equal to 5 seconds
And then a second apart, the next message.
Until it's 4.5 seconds past the first message, and if the message is not over by one second randomly, repeat the search for the latest information to determine whether or not it will be sent.
Loop back and forth until you're done with the message.
Format returned by large models:
{
“think”: “xxxxx”,
“reply”: [`First News', `Second News', `Third News']
“if_difficult_to_answer”: true/false,
“if_difficult_reason”: “xxxxx“
}
If _difficult_to_answer is false, only reply fields are useful. Just send one message out.
If _difficult_to_answer is true, check the update time and call the second prompt and request a large model once more if the query is less than or equal to five seconds before you enter. I need to add to the prept that return, but I haven't decided where to add this, so I can change it directly in the prompt and insert it as a variable. If more than five seconds, save the message that has not been sent into the ending_messages field of the x-profile-bot-gen data sheet (this is an array), then stop the cloud function.
If the message is successfully sent, add new messages (i.e. call x-bot input and this message to the user) to the memory sheet x-memoory-msg and vector database)