MCPcopy Index your code
hub / github.com/tensorflow/tfjs-examples / onSendMessage

Function onSendMessage

intent-classifier/app/index.js:99–109  ·  view source on GitHub ↗
(inputText)

Source from the content-addressed store, hash-verified

97}
98
99async function onSendMessage(inputText) {
100 if (inputText != null && inputText.length > 0) {
101 // Add the input text to the chat window
102 const msgId = appendMessage(inputText, 'input');
103 // Classify the text
104 const classification = await classify([inputText]);
105 // Add the response to the chat window
106 const response = await getClassificationMessage(classification);
107 appendMessage(response, 'bot', msgId);
108 }
109}
110
111let messageId = 0;
112function appendMessage(message, sender, appendAfter) {

Callers 1

setupListenersFunction · 0.70

Calls 3

appendMessageFunction · 0.85
classifyFunction · 0.85
getClassificationMessageFunction · 0.85

Tested by

no test coverage detected