Spaces:
Running
Running
xiao
commited on
Commit
·
c8af9b9
1
Parent(s):
25cdf17
初始化
Browse files- app/api/lemur/route.ts +6 -1
- app/api/newbing/route.ts +7 -1
- app/api/wanjuan/route.ts +8 -1
- app/requests.ts +1 -1
- app/store/config.ts +4 -4
- package.json +3 -0
- yarn.lock +31 -0
app/api/lemur/route.ts
CHANGED
@@ -1,7 +1,12 @@
|
|
1 |
import { createParser } from "eventsource-parser";
|
2 |
-
import { NextRequest } from "next/server";
|
|
|
3 |
|
4 |
async function createStream(req: NextRequest) {
|
|
|
|
|
|
|
|
|
5 |
const encoder = new TextEncoder();
|
6 |
const decoder = new TextDecoder();
|
7 |
|
|
|
1 |
import { createParser } from "eventsource-parser";
|
2 |
+
import { NextRequest, NextResponse } from "next/server";
|
3 |
+
import { auth } from "../auth";
|
4 |
|
5 |
async function createStream(req: NextRequest) {
|
6 |
+
const authResult = auth(req);
|
7 |
+
if (authResult.error) {
|
8 |
+
return authResult.msg;
|
9 |
+
}
|
10 |
const encoder = new TextEncoder();
|
11 |
const decoder = new TextDecoder();
|
12 |
|
app/api/newbing/route.ts
CHANGED
@@ -1,6 +1,12 @@
|
|
|
|
1 |
import { BingChat, ChatMessage } from "../../bing-chat/index";
|
|
|
2 |
|
3 |
-
export async function POST(req:
|
|
|
|
|
|
|
|
|
4 |
try {
|
5 |
let cookies = process.env.COOKIES;
|
6 |
const api = new BingChat({
|
|
|
1 |
+
import { NextRequest } from "next/server";
|
2 |
import { BingChat, ChatMessage } from "../../bing-chat/index";
|
3 |
+
import { auth } from "../auth";
|
4 |
|
5 |
+
export async function POST(req: NextRequest) {
|
6 |
+
const authResult = auth(req);
|
7 |
+
if (authResult.error) {
|
8 |
+
return authResult.msg;
|
9 |
+
}
|
10 |
try {
|
11 |
let cookies = process.env.COOKIES;
|
12 |
const api = new BingChat({
|
app/api/wanjuan/route.ts
CHANGED
@@ -1,4 +1,11 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
try {
|
3 |
let body = { message: await req.json() };
|
4 |
|
|
|
1 |
+
import { NextRequest } from "next/server";
|
2 |
+
import { auth } from "../auth";
|
3 |
+
|
4 |
+
export async function POST(req: NextRequest) {
|
5 |
+
const authResult = auth(req);
|
6 |
+
if (authResult.error) {
|
7 |
+
return authResult.msg;
|
8 |
+
}
|
9 |
try {
|
10 |
let body = { message: await req.json() };
|
11 |
|
app/requests.ts
CHANGED
@@ -368,7 +368,7 @@ export async function requestChatStream(
|
|
368 |
const reqTimeoutId = setTimeout(() => controller.abort(), TIME_OUT_MS);
|
369 |
|
370 |
try {
|
371 |
-
const res = await fetch("/api/
|
372 |
method: "POST",
|
373 |
headers: {
|
374 |
"Content-Type": "application/json",
|
|
|
368 |
const reqTimeoutId = setTimeout(() => controller.abort(), TIME_OUT_MS);
|
369 |
|
370 |
try {
|
371 |
+
const res = await fetch("/api/lemur", {
|
372 |
method: "POST",
|
373 |
headers: {
|
374 |
"Content-Type": "application/json",
|
app/store/config.ts
CHANGED
@@ -92,10 +92,10 @@ export const ALL_BOT = [
|
|
92 |
name: "必应",
|
93 |
available: true,
|
94 |
},
|
95 |
-
{
|
96 |
-
|
97 |
-
|
98 |
-
},
|
99 |
{
|
100 |
name: "万卷",
|
101 |
available: true,
|
|
|
92 |
name: "必应",
|
93 |
available: true,
|
94 |
},
|
95 |
+
// {
|
96 |
+
// name: "必应绘画",
|
97 |
+
// available: true,
|
98 |
+
// },
|
99 |
{
|
100 |
name: "万卷",
|
101 |
available: true,
|
package.json
CHANGED
@@ -16,6 +16,8 @@
|
|
16 |
"@hello-pangea/dnd": "^16.2.0",
|
17 |
"@svgr/webpack": "^6.5.1",
|
18 |
"@vercel/analytics": "^0.1.11",
|
|
|
|
|
19 |
"emoji-picker-react": "^4.4.7",
|
20 |
"eventsource-parser": "^0.1.0",
|
21 |
"fuse.js": "^6.6.2",
|
@@ -34,6 +36,7 @@
|
|
34 |
"sass": "^1.59.2",
|
35 |
"spark-md5": "^3.0.2",
|
36 |
"use-debounce": "^9.0.3",
|
|
|
37 |
"zustand": "^4.3.6"
|
38 |
},
|
39 |
"devDependencies": {
|
|
|
16 |
"@hello-pangea/dnd": "^16.2.0",
|
17 |
"@svgr/webpack": "^6.5.1",
|
18 |
"@vercel/analytics": "^0.1.11",
|
19 |
+
"bing-chat": "^0.2.3",
|
20 |
+
"bufferutil": "^4.0.7",
|
21 |
"emoji-picker-react": "^4.4.7",
|
22 |
"eventsource-parser": "^0.1.0",
|
23 |
"fuse.js": "^6.6.2",
|
|
|
36 |
"sass": "^1.59.2",
|
37 |
"spark-md5": "^3.0.2",
|
38 |
"use-debounce": "^9.0.3",
|
39 |
+
"utf-8-validate": "^6.0.3",
|
40 |
"zustand": "^4.3.6"
|
41 |
},
|
42 |
"devDependencies": {
|
yarn.lock
CHANGED
@@ -1685,6 +1685,13 @@ binary-extensions@^2.0.0:
|
|
1685 |
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d"
|
1686 |
integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==
|
1687 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1688 |
boolbase@^1.0.0:
|
1689 |
version "1.0.0"
|
1690 |
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
|
@@ -1715,6 +1722,13 @@ browserslist@^4.21.3, browserslist@^4.21.5:
|
|
1715 |
node-releases "^2.0.8"
|
1716 |
update-browserslist-db "^1.0.10"
|
1717 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1718 | |
1719 |
version "1.6.0"
|
1720 |
resolved "https://registry.npmmirror.com/busboy/-/busboy-1.6.0.tgz#966ea36a9502e43cdb9146962523b92f531f6893"
|
@@ -3965,6 +3979,11 @@ node-fetch@^3.3.1:
|
|
3965 |
fetch-blob "^3.1.4"
|
3966 |
formdata-polyfill "^4.0.10"
|
3967 |
|
|
|
|
|
|
|
|
|
|
|
3968 |
node-releases@^2.0.8:
|
3969 |
version "2.0.10"
|
3970 |
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.10.tgz#c311ebae3b6a148c89b1813fd7c4d3c024ef537f"
|
@@ -5072,6 +5091,13 @@ [email protected], use-sync-external-store@^1.0.0:
|
|
5072 |
resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a"
|
5073 |
integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==
|
5074 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5075 |
uvu@^0.5.0:
|
5076 |
version "0.5.6"
|
5077 |
resolved "https://registry.yarnpkg.com/uvu/-/uvu-0.5.6.tgz#2754ca20bcb0bb59b64e9985e84d2e81058502df"
|
@@ -5186,6 +5212,11 @@ wrappy@1:
|
|
5186 |
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
5187 |
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==
|
5188 |
|
|
|
|
|
|
|
|
|
|
|
5189 |
yallist@^3.0.2:
|
5190 |
version "3.1.1"
|
5191 |
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd"
|
|
|
1685 |
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d"
|
1686 |
integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==
|
1687 |
|
1688 |
+
bing-chat@^0.2.3:
|
1689 |
+
version "0.2.3"
|
1690 |
+
resolved "https://registry.yarnpkg.com/bing-chat/-/bing-chat-0.2.3.tgz#aba19c55e5dfbe12ceae6e26cbbaf405c146703f"
|
1691 |
+
integrity sha512-q9JIGqrrEhBEgIhTdtawvxcwQO5sdhMN3uATbLxpd52sH0+Jm7QhtsaodlLUbQgEQGo+YXfFPWWpK5lWMXGvHw==
|
1692 |
+
dependencies:
|
1693 |
+
ws "^8.13.0"
|
1694 |
+
|
1695 |
boolbase@^1.0.0:
|
1696 |
version "1.0.0"
|
1697 |
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
|
|
|
1722 |
node-releases "^2.0.8"
|
1723 |
update-browserslist-db "^1.0.10"
|
1724 |
|
1725 |
+
bufferutil@^4.0.7:
|
1726 |
+
version "4.0.7"
|
1727 |
+
resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.7.tgz#60c0d19ba2c992dd8273d3f73772ffc894c153ad"
|
1728 |
+
integrity sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==
|
1729 |
+
dependencies:
|
1730 |
+
node-gyp-build "^4.3.0"
|
1731 |
+
|
1732 | |
1733 |
version "1.6.0"
|
1734 |
resolved "https://registry.npmmirror.com/busboy/-/busboy-1.6.0.tgz#966ea36a9502e43cdb9146962523b92f531f6893"
|
|
|
3979 |
fetch-blob "^3.1.4"
|
3980 |
formdata-polyfill "^4.0.10"
|
3981 |
|
3982 |
+
node-gyp-build@^4.3.0:
|
3983 |
+
version "4.6.0"
|
3984 |
+
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.6.0.tgz#0c52e4cbf54bbd28b709820ef7b6a3c2d6209055"
|
3985 |
+
integrity sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==
|
3986 |
+
|
3987 |
node-releases@^2.0.8:
|
3988 |
version "2.0.10"
|
3989 |
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.10.tgz#c311ebae3b6a148c89b1813fd7c4d3c024ef537f"
|
|
|
5091 |
resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a"
|
5092 |
integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==
|
5093 |
|
5094 |
+
utf-8-validate@^6.0.3:
|
5095 |
+
version "6.0.3"
|
5096 |
+
resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-6.0.3.tgz#7d8c936d854e86b24d1d655f138ee27d2636d777"
|
5097 |
+
integrity sha512-uIuGf9TWQ/y+0Lp+KGZCMuJWc3N9BHA+l/UmHd/oUHwJJDeysyTRxNQVkbzsIWfGFbRe3OcgML/i0mvVRPOyDA==
|
5098 |
+
dependencies:
|
5099 |
+
node-gyp-build "^4.3.0"
|
5100 |
+
|
5101 |
uvu@^0.5.0:
|
5102 |
version "0.5.6"
|
5103 |
resolved "https://registry.yarnpkg.com/uvu/-/uvu-0.5.6.tgz#2754ca20bcb0bb59b64e9985e84d2e81058502df"
|
|
|
5212 |
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
5213 |
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==
|
5214 |
|
5215 |
+
ws@^8.13.0:
|
5216 |
+
version "8.13.0"
|
5217 |
+
resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0"
|
5218 |
+
integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==
|
5219 |
+
|
5220 |
yallist@^3.0.2:
|
5221 |
version "3.1.1"
|
5222 |
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd"
|