forked from React-Group/interstellar_ai
Merge pull request 'main' (#38) from React-Group/interstellar_ai:main into main
Reviewed-on: https://interstellardevelopment.org/code/code/sageTheDm/interstellar_ai/pulls/38
This commit is contained in:
commit
ca868c9e12
6 changed files with 1661 additions and 8 deletions
|
@ -50,8 +50,10 @@ const InputOutputBackend: React.FC = () => {
|
||||||
The currency is ${preferredCurrency}.
|
The currency is ${preferredCurrency}.
|
||||||
Communicate in the language specified by the user (country code: ${preferredLanguage}), and only in this language.
|
Communicate in the language specified by the user (country code: ${preferredLanguage}), and only in this language.
|
||||||
You are only able to change language if the user specifically states you must.
|
You are only able to change language if the user specifically states you must.
|
||||||
Do not answer in multiple languages or multiple measurement systems under any circumstances other than the user requesting it.`
|
Do not answer in multiple languages or multiple measurement systems under any circumstances other than the user requesting it.
|
||||||
: "You are a helpful assistant";
|
You try to use html tags as often as possible in your responses. For images, links and tables you use markdown.`
|
||||||
|
: `You are a helpful assistant
|
||||||
|
You try to use html tags as often as possible in your responses. For images, links and tables you use markdown. You cannot use both at the same time.`;
|
||||||
setMessages([
|
setMessages([
|
||||||
{ role: "system", content: systemMessage },
|
{ role: "system", content: systemMessage },
|
||||||
{ role: "assistant", content: "Hello! How may I help you?" },
|
{ role: "assistant", content: "Hello! How may I help you?" },
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
import React, { ForwardedRef, useState, useEffect, useRef } from 'react';
|
import React, { ForwardedRef, useState, useEffect, useRef } from 'react';
|
||||||
|
import Markdown from 'react-markdown'
|
||||||
|
import rehypeRaw from 'rehype-raw';
|
||||||
|
import remarkGfm from 'remark-gfm';
|
||||||
|
|
||||||
type Message = {
|
type Message = {
|
||||||
role: string
|
role: string
|
||||||
|
@ -66,7 +69,9 @@ const ConversationFrontend = React.forwardRef<HTMLDivElement, ConversationProps>
|
||||||
key={index}
|
key={index}
|
||||||
className={message.role === "user" ? 'user-message' : 'ai-message'}
|
className={message.role === "user" ? 'user-message' : 'ai-message'}
|
||||||
>
|
>
|
||||||
<p> {message.content}</p>
|
<Markdown remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeRaw]}>
|
||||||
|
{message.content}
|
||||||
|
</Markdown>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,6 +225,8 @@ const ModelSection: React.FC = () => {
|
||||||
const newModel = event.target.value;
|
const newModel = event.target.value;
|
||||||
setSelectedModelDropdown(newModel);
|
setSelectedModelDropdown(newModel);
|
||||||
localStorage.setItem('selectedModelDropdown', newModel); // Update localStorage directly
|
localStorage.setItem('selectedModelDropdown', newModel); // Update localStorage directly
|
||||||
|
var model = localStorage.getItem('activeSelectedAIFunction') || "Code"
|
||||||
|
modelClicked(model)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Determine the filtered models based on current radioSelection
|
// Determine the filtered models based on current radioSelection
|
||||||
|
@ -285,7 +287,8 @@ const ModelSection: React.FC = () => {
|
||||||
const modelClicked = (model: string) => {
|
const modelClicked = (model: string) => {
|
||||||
localStorage.setItem('activeSelectedAIFunction', model)
|
localStorage.setItem('activeSelectedAIFunction', model)
|
||||||
setActiveSelectedAIFunction(model)
|
setActiveSelectedAIFunction(model)
|
||||||
const selectedAIFunction = selectedModelDropdown as keyof typeof modelList;
|
var modelDropdown = localStorage.getItem('selectedModelDropdown') || 'Offline Fast'
|
||||||
|
const selectedAIFunction = modelDropdown as keyof typeof modelList;
|
||||||
localStorage.setItem("model", modelList[selectedAIFunction][model as keyof typeof modelList[typeof selectedAIFunction]])
|
localStorage.setItem("model", modelList[selectedAIFunction][model as keyof typeof modelList[typeof selectedAIFunction]])
|
||||||
localStorage.setItem("type", modelList[selectedAIFunction]['model_type' as keyof typeof modelList[typeof selectedAIFunction]])
|
localStorage.setItem("type", modelList[selectedAIFunction]['model_type' as keyof typeof modelList[typeof selectedAIFunction]])
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,23 @@
|
||||||
color: var(--ai-message-text-color);
|
color: var(--ai-message-text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ai-message a{
|
||||||
|
color: var(--text-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ai-message table, th, tr, td{
|
||||||
|
border: 2px solid black;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ai-message img{
|
||||||
|
max-width: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ai-message a:hover{
|
||||||
|
filter: brightness(70%);
|
||||||
|
}
|
||||||
|
|
||||||
/* Button Container */
|
/* Button Container */
|
||||||
.button-container {
|
.button-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
1631
package-lock.json
generated
1631
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -26,7 +26,10 @@
|
||||||
"ollama": "^0.5.9",
|
"ollama": "^0.5.9",
|
||||||
"react": "^18",
|
"react": "^18",
|
||||||
"react-dom": "^18",
|
"react-dom": "^18",
|
||||||
|
"react-markdown": "^9.0.1",
|
||||||
"react-router-dom": "^6.26.2",
|
"react-router-dom": "^6.26.2",
|
||||||
|
"rehype-raw": "^7.0.0",
|
||||||
|
"remark-gfm": "^4.0.0",
|
||||||
"swiss": "^2.4.0",
|
"swiss": "^2.4.0",
|
||||||
"weather": "^1.0.4"
|
"weather": "^1.0.4"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue