Spaces:
Runtime error
Runtime error
Commit
·
1f2102d
1
Parent(s):
fb314b4
Update pages/api/home/home.tsx
Browse files- pages/api/home/home.tsx +0 -23
pages/api/home/home.tsx
CHANGED
|
@@ -53,8 +53,6 @@ const Home = ({
|
|
| 53 |
defaultModelId,
|
| 54 |
}: Props) => {
|
| 55 |
const { t } = useTranslation('chat');
|
| 56 |
-
const { getModels } = useApiService();
|
| 57 |
-
const { getModelsError } = useErrorService();
|
| 58 |
const [initialRender, setInitialRender] = useState<boolean>(true);
|
| 59 |
|
| 60 |
const contextValue = useCreateReducer<HomeInitialState>({
|
|
@@ -76,27 +74,6 @@ const Home = ({
|
|
| 76 |
|
| 77 |
const stopConversationRef = useRef<boolean>(false);
|
| 78 |
|
| 79 |
-
const { data, error, refetch } = useQuery(
|
| 80 |
-
['GetModels', apiKey, serverSideApiKeyIsSet],
|
| 81 |
-
({ signal }) => {
|
| 82 |
-
|
| 83 |
-
return getModels(
|
| 84 |
-
{
|
| 85 |
-
key: 'apiKey',
|
| 86 |
-
},
|
| 87 |
-
signal,
|
| 88 |
-
);
|
| 89 |
-
},
|
| 90 |
-
{ enabled: true, refetchOnMount: false },
|
| 91 |
-
);
|
| 92 |
-
|
| 93 |
-
useEffect(() => {
|
| 94 |
-
if (data) dispatch({ field: 'models', value: data });
|
| 95 |
-
}, [data, dispatch]);
|
| 96 |
-
|
| 97 |
-
useEffect(() => {
|
| 98 |
-
dispatch({ field: 'modelError', value: getModelsError(error) });
|
| 99 |
-
}, [dispatch, error, getModelsError]);
|
| 100 |
|
| 101 |
// FETCH MODELS ----------------------------------------------
|
| 102 |
|
|
|
|
| 53 |
defaultModelId,
|
| 54 |
}: Props) => {
|
| 55 |
const { t } = useTranslation('chat');
|
|
|
|
|
|
|
| 56 |
const [initialRender, setInitialRender] = useState<boolean>(true);
|
| 57 |
|
| 58 |
const contextValue = useCreateReducer<HomeInitialState>({
|
|
|
|
| 74 |
|
| 75 |
const stopConversationRef = useRef<boolean>(false);
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
// FETCH MODELS ----------------------------------------------
|
| 79 |
|