fix convo
This commit is contained in:
		
							parent
							
								
									3b5796cae6
								
							
						
					
					
						commit
						981b96dc04
					
				
					 2 changed files with 12 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -19,7 +19,9 @@ const ConversationFrontend = React.forwardRef<HTMLDivElement, ConversationProps>
 | 
			
		|||
                key={index}
 | 
			
		||||
                className={isUserMessage ? 'user-message' : 'ai-message'}
 | 
			
		||||
              >
 | 
			
		||||
                <p>
 | 
			
		||||
                {message}
 | 
			
		||||
                </p>
 | 
			
		||||
              </div>
 | 
			
		||||
            );
 | 
			
		||||
          })}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,13 @@ import InputFrontend from './InputFrontend';
 | 
			
		|||
import ConversationFrontend from './ConversationFrontend';
 | 
			
		||||
import { Mistral } from '@mistralai/mistralai';
 | 
			
		||||
 | 
			
		||||
var messages = [
 | 
			
		||||
  'User: Hello!',
 | 
			
		||||
  'AI: Hi there!',
 | 
			
		||||
  'User: How are you?',
 | 
			
		||||
  'AI: I’m good, thank you!'
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
async function prompt_mistral(model: string, prompt: string, system: string) {
 | 
			
		||||
  const apiKey = "m3kZRjN8DRSIo88r8Iti9hmKGWIklrLY";
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -15,8 +22,9 @@ async function prompt_mistral(model: string, prompt: string, system: string) {
 | 
			
		|||
 | 
			
		||||
  if (chatResponse && chatResponse.choices && chatResponse.choices.length > 0) {
 | 
			
		||||
    if (chatResponse.choices[0].message.content) {
 | 
			
		||||
      messages.push('AI: ', chatResponse.choices[0].message.content);
 | 
			
		||||
      messages.push('AI: ' + chatResponse.choices[0].message.content);
 | 
			
		||||
      console.error('Error: Brain Not Found');
 | 
			
		||||
      console.log(messages)
 | 
			
		||||
    }
 | 
			
		||||
  } else {
 | 
			
		||||
    console.error('Error: Unexpected API response:', chatResponse);
 | 
			
		||||
| 
						 | 
				
			
			@ -24,7 +32,7 @@ async function prompt_mistral(model: string, prompt: string, system: string) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
const handleSendClick = (message: string) => {
 | 
			
		||||
  messages.push('User: ', message);
 | 
			
		||||
  messages.push('User: ' + message);
 | 
			
		||||
  prompt_mistral("mistral-large-latest", message, "You are a helpful assistant.")
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -33,12 +41,6 @@ const handleMicClick = () => {
 | 
			
		|||
  // Do something when the mic button is clicked
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
var messages = [
 | 
			
		||||
  'User: Hello!',
 | 
			
		||||
  'AI: Hi there!',
 | 
			
		||||
  'User: How are you?',
 | 
			
		||||
  'AI: I’m good, thank you!'
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
const handleResendClick = () => {
 | 
			
		||||
  console.log('Resend button clicked');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue