forked from u14app/gemini-next-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Reconstruct file upload logic to be compatible with docker …
…deployment solution refactor: Use manifest.json instead of dynamically generating manifest solutions
- Loading branch information
Showing
13 changed files
with
213 additions
and
122 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { NextResponse, type NextRequest } from 'next/server' | ||
import { checkToken, handleError } from '../utils' | ||
import FileManager from '@/utils/FileManager' | ||
import { ErrorType } from '@/constant/errors' | ||
import { isNull } from 'lodash-es' | ||
|
||
const geminiApiKey = process.env.GEMINI_API_KEY as string | ||
const geminiApiBaseUrl = process.env.GEMINI_API_BASE_URL as string | ||
const mode = process.env.NEXT_PUBLIC_BUILD_MODE | ||
|
||
export const preferredRegion = ['sfo1'] | ||
|
||
export async function GET(req: NextRequest) { | ||
if (mode === 'export') return new NextResponse('Not available under static deployment') | ||
|
||
const searchParams = req.nextUrl.searchParams | ||
const token = searchParams.get('token') | ||
const id = searchParams.get('id') | ||
|
||
if (isNull(token) || !checkToken(token)) { | ||
return NextResponse.json({ code: 40301, message: ErrorType.InValidToken }, { status: 403 }) | ||
} | ||
if (!geminiApiKey) { | ||
return NextResponse.json({ code: 50001, message: ErrorType.NoGeminiKey }, { status: 500 }) | ||
} | ||
if (isNull(id)) { | ||
return NextResponse.json({ code: 40001, message: ErrorType.MissingParam }, { status: 400 }) | ||
} | ||
|
||
try { | ||
const fileManager = new FileManager({ apiKey: geminiApiKey, baseUrl: geminiApiBaseUrl }) | ||
const result = await fileManager.getFileMetadata(id) | ||
return NextResponse.json(result) | ||
} catch (error) { | ||
if (error instanceof Error) { | ||
return handleError(error.message) | ||
} | ||
} | ||
} |
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "talk-with-gemini", | ||
"version": "0.10.4", | ||
"version": "0.10.5", | ||
"private": true, | ||
"author": "Amery2010 <[email protected]>", | ||
"license": "GPL-3.0-only", | ||
|
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,46 @@ | ||
{ | ||
"name": "Talk with Gemini", | ||
"short_name": "Talk with Gemini", | ||
"description": "Deploy your private Gemini application for free with one click, supporting Gemini 1.5 Pro, Gemini 1.5 Flash, Gemini Pro and Gemini Pro Vision models.", | ||
"id": "talk-with-gemini", | ||
"icons": [ | ||
{ | ||
"src": "icons/logo-192x192.png", | ||
"sizes": "72x72 96x96 128x128 152x152 167x167 180x180 192x192", | ||
"type": "image/png", | ||
"purpose": "maskable" | ||
}, | ||
{ | ||
"src": "icons/logo-512x512.png", | ||
"sizes": "256x256 512x512", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "logo.svg", | ||
"sizes": "any", | ||
"type": "svg+xml" | ||
} | ||
], | ||
"screenshots": [ | ||
{ | ||
"src": "screenshots/app.jpg", | ||
"sizes": "2048x1192", | ||
"type": "image/jpeg" | ||
}, | ||
{ | ||
"src": "screenshots/gemini-1.5.jpg", | ||
"sizes": "1920x863", | ||
"type": "image/jpeg" | ||
}, | ||
{ | ||
"src": "screenshots/assistant-market.jpg", | ||
"sizes": "1920x872", | ||
"type": "image/jpeg" | ||
} | ||
], | ||
"theme_color": "#FFFFFF", | ||
"background_color": "#FFFFFF", | ||
"start_url": ".", | ||
"display": "standalone", | ||
"orientation": "portrait" | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.