forked from React-Group/interstellar_ai
Merge pull request 'fix convo' (#4) from YasinOnm08/interstellar_ai:main into main
Reviewed-on: https://interstellardevelopment.org/code/code/React-Group/interstellar_ai/pulls/4
This commit is contained in:
commit
4962319fcb
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…
Reference in a new issue