mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-16 14:03:43 +08:00
Merge remote-tracking branch 'upstream/main' into dev
# Conflicts: # app/components/chat.tsx # app/components/home.tsx # app/components/settings.tsx # app/components/sidebar.tsx # app/config/server.ts # app/constant.ts # app/layout.tsx # app/store/access.ts # app/utils/model.ts
This commit is contained in:
@@ -15,6 +15,10 @@ self.addEventListener("install", function (event) {
|
||||
);
|
||||
});
|
||||
|
||||
function jsonify(data) {
|
||||
return new Response(JSON.stringify(data), { headers: { 'content-type': 'application/json' } })
|
||||
}
|
||||
|
||||
async function upload(request, url) {
|
||||
const formData = await request.formData()
|
||||
const file = formData.getAll('file')[0]
|
||||
@@ -33,13 +37,13 @@ async function upload(request, url) {
|
||||
'server': 'ServiceWorker',
|
||||
}
|
||||
}))
|
||||
return Response.json({ code: 0, data: fileUrl })
|
||||
return jsonify({ code: 0, data: fileUrl })
|
||||
}
|
||||
|
||||
async function remove(request, url) {
|
||||
const cache = await caches.open(CHATGPT_NEXT_WEB_FILE_CACHE)
|
||||
const res = await cache.delete(request.url)
|
||||
return Response.json({ code: 0 })
|
||||
return jsonify({ code: 0 })
|
||||
}
|
||||
|
||||
self.addEventListener("fetch", (e) => {
|
||||
@@ -56,4 +60,3 @@ self.addEventListener("fetch", (e) => {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user