Spaces:
Running
Running
| function sendInput() { | |
| let message = inputText.trim(); | |
| if (message!== '') { | |
| chatLog.push(`You: ${message}`); | |
| inputText = ''; | |
| let response = getResponse(message, storyTheme); | |
| chatLog.push(`Bot: ${response}`); | |
| } | |
| } | |
| function getResponse(input, theme) { | |
| // Call Mixtral 7b API or implement your own logic here | |
| // For demonstration purposes, return a random response | |
| let responses = [ | |
| 'That sounds interesting!', | |
| 'Can you tell me more about that?', | |
| 'Let\'s explore that idea further!', | |
| 'I\'m not sure I understand, can you clarify?', | |
| ]; | |
| return responses[Math.floor(Math.random() * responses.length)]; | |
| } |