NextJS 14 experimental upgrade

This commit is contained in:
Koper
2023-12-26 20:49:40 +07:00
parent ee3b4cb9f7
commit 9f42c4d8a7
12 changed files with 1243 additions and 146 deletions

View File

@@ -24,6 +24,11 @@ It also uses https://github.com/fief-dev for authentication, and Vercel for depl
- [Back-End](#back-end)
- [Installation](#installation-1)
- [Start the API/Backend](#start-the-apibackend)
- [Redis (Mac)](#redis-mac)
- [Redis (Windows)](#redis-windows)
- [Update the database schema (run on first install, and after each pull containing a migration)](#update-the-database-schema-run-on-first-install-and-after-each-pull-containing-a-migration)
- [Main Server](#main-server)
- [Crontab (optional)](#crontab-optional)
- [Using docker](#using-docker)
- [Using local GPT4All](#using-local-gpt4all)
- [Using local files](#using-local-files)
@@ -152,7 +157,7 @@ redis-server
## Update the database schema (run on first install, and after each pull containing a migration)
```bash
poetry run python alembic head
poetry run alembic heads
```
## Main Server

View File

@@ -3,7 +3,6 @@ import { useError } from "../../(errors)/errorContext";
import { GetTranscript, CreateTranscript } from "../../api";
import useApi from "../../lib/useApi";
type UseTranscript = {
transcript: GetTranscript | null;
loading: boolean;
@@ -23,26 +22,16 @@ const useCreateTranscript = (): UseTranscript => {
setLoading(true);
console.debug(
console.log(
"POST - /v1/transcripts/ - Requesting new transcription creation",
transcriptCreationDetails,
api
api,
);
const aaa = async () => {
console.log("Calling API...");
console.log("START");
await new Promise((res) => setTimeout(res, 500));
console.log("500 ms elapsed - calling api");
const test = await api.v1TranscriptsCreate(transcriptCreationDetails);
console.log(test);
};
aaa();
api.v1TranscriptsCreate(transcriptCreationDetails)
api
.v1TranscriptsCreate(transcriptCreationDetails)
.then((transcript) => {
console.debug("New transcript created:", transcript);
setTranscript(transcript);
@@ -55,6 +44,9 @@ const useCreateTranscript = (): UseTranscript => {
);
setErrorState(err);
setLoading(false);
})
.finally(() => {
console.log("At least this should display?");
});
};

View File

@@ -89,7 +89,8 @@ const ShareLink = (props: ShareLinkProps) => {
<p>This transcript is public. Everyone can access it.</p>
)}
{isOwner && apiReady (
{isOwner &&
apiReady(
<div className="relative">
<SelectSearch
className="select-search--top select-search"
@@ -110,7 +111,7 @@ const ShareLink = (props: ShareLinkProps) => {
/>
</div>
)}
</div>
</div>,
)}
</div>
)}

View File

@@ -21,7 +21,8 @@ const useTopics = (id: string): TranscriptTopics => {
if (!id || !api) return;
setLoading(true);
api.v1TranscriptGetTopics(id)
api
.v1TranscriptGetTopics(id)
.then((result) => {
setTopics(result);
setLoading(false);

View File

@@ -36,7 +36,8 @@ const useTranscript = (
setLoading(true);
api.v1TranscriptGet(id)
api
.v1TranscriptGet(id)
.then((result) => {
setResponse(result);
setLoading(false);

View File

@@ -19,10 +19,9 @@ const useTranscriptList = (page: number): TranscriptList => {
useEffect(() => {
setLoading(true);
if (!api)
return;
api.v1TranscriptsList(page)
if (!api) return;
api
.v1TranscriptsList(page)
.then((response) => {
setResponse(response);
setLoading(false);

View File

@@ -19,12 +19,11 @@ export default function useApi(): DefaultService | null {
return;
}
if (!accessTokenInfo)
return;
if (!accessTokenInfo) return;
const openApi = new OpenApi({
BASE: api_url,
TOKEN: accessTokenInfo?.access_token
TOKEN: accessTokenInfo?.access_token,
});
setApi(openApi);

View File

@@ -20,10 +20,12 @@
"@vercel/edge-config": "^0.4.1",
"autoprefixer": "10.4.14",
"axios": "^1.6.2",
"eslint-config-next": "^14.0.4",
"fontawesome": "^5.6.3",
"jest-worker": "^29.6.2",
"next": "^13.4.9",
"next": "^14.0.4",
"postcss": "8.4.25",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-dropdown": "^1.11.0",

View File

@@ -19,7 +19,8 @@
}
],
"strictNullChecks": true,
"downlevelIteration": true
"downlevelIteration": true,
"target": "ES2020"
},
"include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]

File diff suppressed because it is too large Load Diff