mistral:latest as default model.

Removed required default model.
This commit is contained in:
ivanfioravanti
2023-10-08 22:06:40 +02:00
parent 214c2470e0
commit 1f0d957634
3 changed files with 10 additions and 32 deletions

View File

@@ -23,7 +23,7 @@ COPY --from=build /app/next.config.js ./next.config.js
COPY --from=build /app/next-i18next.config.js ./next-i18next.config.js
# Set the environment variable
ENV DEFAULT_MODEL="llama2:latest"
ENV DEFAULT_MODEL="mistral:latest"
ENV OLLAMA_HOST="http://host.docker.internal:11434"
# Expose the port the app will run on

View File

@@ -40,15 +40,12 @@ import HomeContext from './home.context';
import { HomeInitialState, initialState } from './home.state';
import { v4 as uuidv4 } from 'uuid';
import toast from "react-hot-toast"
interface Props {
defaultModelId: OllamaModelID;
}
const Home = ({
defaultModelId,
}: Props) => {
const Home = ({ defaultModelId }: Props) => {
const { t } = useTranslation('chat');
const { getModels } = useApiService();
const { getModelsError } = useErrorService();
@@ -72,11 +69,10 @@ const Home = ({
const stopConversationRef = useRef<boolean>(false);
const { data, error, refetch } = useQuery(
['GetModels'],
() => getModels(),
{ enabled: true, refetchOnMount: false },
);
const { data, error, refetch } = useQuery(['GetModels'], () => getModels(), {
enabled: true,
refetchOnMount: false,
});
useEffect(() => {
if (data) dispatch({ field: 'models', value: data });
@@ -220,17 +216,7 @@ const Home = ({
dispatch({ field: 'defaultModelId', value: defaultModelId });
}, [defaultModelId]);
// ON LOAD --------------------------------------------
useEffect(() => {
// Check default model availability
const defaultModel = OllamaModels[defaultModelId];
if (data && !data.some(model => model.name === defaultModel.name)) {
toast.error("The default model set in your .env settings is not installed. Please update your .env or install the required model.", {duration:20000});
return;
}
}, [data]);
useEffect(() => {
const settings = getSettings();
if (settings.theme) {
dispatch({
@@ -302,10 +288,7 @@ const Home = ({
},
});
}
}, [
defaultModelId,
dispatch,
]);
}, [defaultModelId, dispatch]);
return (
<HomeContext.Provider
@@ -356,13 +339,8 @@ const Home = ({
export default Home;
export const getServerSideProps: GetServerSideProps = async ({ locale }) => {
const defaultModelId =
(process.env.DEFAULT_MODEL &&
Object.values(OllamaModelID).includes(
process.env.DEFAULT_MODEL as OllamaModelID,
) &&
process.env.DEFAULT_MODEL) ||
fallbackModelID;
const defaultModelId =
process.env.DEFAULT_MODEL || fallbackModelID;
return {
props: {

View File

@@ -13,7 +13,7 @@ export interface OllamaModelDetail {
}
export enum OllamaModelID {
DEFAULTMODEL = 'llama2:latest'
DEFAULTMODEL = 'mistral:latest'
}
// in case the `DEFAULT_MODEL` environment variable is not set or set to an unsupported model