-
Notifications
You must be signed in to change notification settings - Fork 706
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
205 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
OPENAI_API_KEY= | ||
UPSTASH_REDIS_REST_URL= | ||
UPSTASH_REDIS_REST_TOKEN= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { NextResponse } from "next/server"; | ||
import type { NextFetchEvent, NextRequest } from "next/server"; | ||
import { Redis } from "@upstash/redis"; | ||
|
||
export async function middleware(req: NextRequest, ev: NextFetchEvent) { | ||
const { bvId } = await req.json(); | ||
const redis = Redis.fromEnv(); | ||
|
||
const result = await redis.get<string>(bvId); | ||
if (result) { | ||
console.log("hit cache for ", bvId); | ||
return NextResponse.json(result); | ||
} | ||
} | ||
|
||
export const config = { | ||
matcher: "/api/summarize", | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
25193d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
chat-bilibili-video – ./
bilibili.jimmylv.cn
chat-bilibili-video-jimmylv.vercel.app
chat-bilibili-video.vercel.app
b.jimmylv.cn
www.bilibili.jimmylv.cn
chat-bilibili-video-git-main-jimmylv.vercel.app
m.bilibili.jimmylv.cn