mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-09-01 12:46:58 +08:00
Compare commits
10 Commits
v2.15.7
...
feature/aa
Author | SHA1 | Date | |
---|---|---|---|
|
a9c2dd6cc8 | ||
|
4148a50b7d | ||
|
49aeff4473 | ||
|
b7394bc10c | ||
|
f2aeb83e4e | ||
|
030234c498 | ||
|
77805a45b1 | ||
|
655332cca0 | ||
|
bb7c6c517b | ||
|
4624b9d778 |
12
.github/workflows/app.yml
vendored
12
.github/workflows/app.yml
vendored
@@ -40,15 +40,9 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
config:
|
config:
|
||||||
- os: ubuntu-latest
|
- os: self-hosted
|
||||||
arch: x86_64
|
|
||||||
rust_target: x86_64-unknown-linux-gnu
|
|
||||||
- os: macos-latest
|
|
||||||
arch: aarch64
|
arch: aarch64
|
||||||
rust_target: x86_64-apple-darwin,aarch64-apple-darwin
|
rust_target: aarch64-unknown-linux-gnu
|
||||||
- os: windows-latest
|
|
||||||
arch: x86_64
|
|
||||||
rust_target: x86_64-pc-windows-msvc
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.config.os }}
|
runs-on: ${{ matrix.config.os }}
|
||||||
steps:
|
steps:
|
||||||
@@ -85,7 +79,7 @@ jobs:
|
|||||||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||||
with:
|
with:
|
||||||
releaseId: ${{ needs.create-release.outputs.release_id }}
|
releaseId: ${{ needs.create-release.outputs.release_id }}
|
||||||
args: ${{ matrix.config.os == 'macos-latest' && '--target universal-apple-darwin' || '' }}
|
args: ${{ matrix.config.os == 'macos-latest' && '--target universal-apple-darwin' || matrix.config.os == 'ubuntu-latest' && matrix.config.arch == 'aarch64' && '--target aarch64-unknown-linux-gnu' || '' }}
|
||||||
|
|
||||||
publish-release:
|
publish-release:
|
||||||
permissions:
|
permissions:
|
||||||
|
13
README.md
13
README.md
@@ -31,7 +31,7 @@ One-Click to get a well-designed cross-platform ChatGPT web UI, with GPT3, GPT4
|
|||||||
[MacOS-image]: https://img.shields.io/badge/-MacOS-black?logo=apple
|
[MacOS-image]: https://img.shields.io/badge/-MacOS-black?logo=apple
|
||||||
[Linux-image]: https://img.shields.io/badge/-Linux-333?logo=ubuntu
|
[Linux-image]: https://img.shields.io/badge/-Linux-333?logo=ubuntu
|
||||||
|
|
||||||
[<img src="https://vercel.com/button" alt="Deploy on Vercel" height="30">](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FChatGPTNextWeb%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=nextchat&repository-name=NextChat) [<img src="https://zeabur.com/button.svg" alt="Deploy on Zeabur" height="30">](https://zeabur.com/templates/ZBUEFA) [<img src="https://gitpod.io/button/open-in-gitpod.svg" alt="Open in Gitpod" height="30">](https://gitpod.io/#https://github.com/Yidadaa/ChatGPT-Next-Web) [<img src="https://img.shields.io/badge/BT_Deploy-Install-20a53a" alt="BT Deply Install" height="30">](https://www.bt.cn/new/download.html) [<img src="https://svgshare.com/i/1AVg.svg" alt="Deploy to Alibaba Cloud" height="30">](https://computenest.aliyun.com/market/service-f1c9b75e59814dc49d52)
|
[<img src="https://vercel.com/button" alt="Deploy on Zeabur" height="30">](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FChatGPTNextWeb%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=nextchat&repository-name=NextChat) [<img src="https://zeabur.com/button.svg" alt="Deploy on Zeabur" height="30">](https://zeabur.com/templates/ZBUEFA) [<img src="https://gitpod.io/button/open-in-gitpod.svg" alt="Open in Gitpod" height="30">](https://gitpod.io/#https://github.com/Yidadaa/ChatGPT-Next-Web)
|
||||||
|
|
||||||
[<img src="https://github.com/user-attachments/assets/903482d4-3e87-4134-9af1-f2588fa90659" height="60" width="288" >](https://monica.im/?utm=nxcrp)
|
[<img src="https://github.com/user-attachments/assets/903482d4-3e87-4134-9af1-f2588fa90659" height="60" width="288" >](https://monica.im/?utm=nxcrp)
|
||||||
|
|
||||||
@@ -301,14 +301,6 @@ iflytek Api Key.
|
|||||||
|
|
||||||
iflytek Api Secret.
|
iflytek Api Secret.
|
||||||
|
|
||||||
### `CHATGLM_API_KEY` (optional)
|
|
||||||
|
|
||||||
ChatGLM Api Key.
|
|
||||||
|
|
||||||
### `CHATGLM_URL` (optional)
|
|
||||||
|
|
||||||
ChatGLM Api Url.
|
|
||||||
|
|
||||||
### `HIDE_USER_API_KEY` (optional)
|
### `HIDE_USER_API_KEY` (optional)
|
||||||
|
|
||||||
> Default: Empty
|
> Default: Empty
|
||||||
@@ -405,9 +397,6 @@ yarn dev
|
|||||||
|
|
||||||
> [简体中文 > 如何部署到私人服务器](./README_CN.md#部署)
|
> [简体中文 > 如何部署到私人服务器](./README_CN.md#部署)
|
||||||
|
|
||||||
### BT Install
|
|
||||||
> [简体中文 > 如何通过宝塔一键部署](./docs/bt-cn.md)
|
|
||||||
|
|
||||||
### Docker (Recommended)
|
### Docker (Recommended)
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
10
README_CN.md
10
README_CN.md
@@ -184,13 +184,6 @@ ByteDance Api Url.
|
|||||||
|
|
||||||
讯飞星火Api Secret.
|
讯飞星火Api Secret.
|
||||||
|
|
||||||
### `CHATGLM_API_KEY` (可选)
|
|
||||||
|
|
||||||
ChatGLM Api Key.
|
|
||||||
|
|
||||||
### `CHATGLM_URL` (可选)
|
|
||||||
|
|
||||||
ChatGLM Api Url.
|
|
||||||
|
|
||||||
|
|
||||||
### `HIDE_USER_API_KEY` (可选)
|
### `HIDE_USER_API_KEY` (可选)
|
||||||
@@ -271,9 +264,6 @@ BASE_URL=https://b.nextweb.fun/api/proxy
|
|||||||
|
|
||||||
## 部署
|
## 部署
|
||||||
|
|
||||||
### 宝塔面板部署
|
|
||||||
> [简体中文 > 如何通过宝塔一键部署](./docs/bt-cn.md)
|
|
||||||
|
|
||||||
### 容器部署 (推荐)
|
### 容器部署 (推荐)
|
||||||
|
|
||||||
> Docker 版本需要在 20 及其以上,否则会提示找不到镜像。
|
> Docker 版本需要在 20 及其以上,否则会提示找不到镜像。
|
||||||
|
@@ -10,8 +10,6 @@ import { handle as alibabaHandler } from "../../alibaba";
|
|||||||
import { handle as moonshotHandler } from "../../moonshot";
|
import { handle as moonshotHandler } from "../../moonshot";
|
||||||
import { handle as stabilityHandler } from "../../stability";
|
import { handle as stabilityHandler } from "../../stability";
|
||||||
import { handle as iflytekHandler } from "../../iflytek";
|
import { handle as iflytekHandler } from "../../iflytek";
|
||||||
import { handle as xaiHandler } from "../../xai";
|
|
||||||
import { handle as chatglmHandler } from "../../glm";
|
|
||||||
import { handle as proxyHandler } from "../../proxy";
|
import { handle as proxyHandler } from "../../proxy";
|
||||||
|
|
||||||
async function handle(
|
async function handle(
|
||||||
@@ -40,10 +38,6 @@ async function handle(
|
|||||||
return stabilityHandler(req, { params });
|
return stabilityHandler(req, { params });
|
||||||
case ApiPath.Iflytek:
|
case ApiPath.Iflytek:
|
||||||
return iflytekHandler(req, { params });
|
return iflytekHandler(req, { params });
|
||||||
case ApiPath.XAI:
|
|
||||||
return xaiHandler(req, { params });
|
|
||||||
case ApiPath.ChatGLM:
|
|
||||||
return chatglmHandler(req, { params });
|
|
||||||
case ApiPath.OpenAI:
|
case ApiPath.OpenAI:
|
||||||
return openaiHandler(req, { params });
|
return openaiHandler(req, { params });
|
||||||
default:
|
default:
|
||||||
|
@@ -92,12 +92,6 @@ export function auth(req: NextRequest, modelProvider: ModelProvider) {
|
|||||||
systemApiKey =
|
systemApiKey =
|
||||||
serverConfig.iflytekApiKey + ":" + serverConfig.iflytekApiSecret;
|
serverConfig.iflytekApiKey + ":" + serverConfig.iflytekApiSecret;
|
||||||
break;
|
break;
|
||||||
case ModelProvider.XAI:
|
|
||||||
systemApiKey = serverConfig.xaiApiKey;
|
|
||||||
break;
|
|
||||||
case ModelProvider.ChatGLM:
|
|
||||||
systemApiKey = serverConfig.chatglmApiKey;
|
|
||||||
break;
|
|
||||||
case ModelProvider.GPT:
|
case ModelProvider.GPT:
|
||||||
default:
|
default:
|
||||||
if (req.nextUrl.pathname.includes("azure/deployments")) {
|
if (req.nextUrl.pathname.includes("azure/deployments")) {
|
||||||
|
129
app/api/glm.ts
129
app/api/glm.ts
@@ -1,129 +0,0 @@
|
|||||||
import { getServerSideConfig } from "@/app/config/server";
|
|
||||||
import {
|
|
||||||
CHATGLM_BASE_URL,
|
|
||||||
ApiPath,
|
|
||||||
ModelProvider,
|
|
||||||
ServiceProvider,
|
|
||||||
} from "@/app/constant";
|
|
||||||
import { prettyObject } from "@/app/utils/format";
|
|
||||||
import { NextRequest, NextResponse } from "next/server";
|
|
||||||
import { auth } from "@/app/api/auth";
|
|
||||||
import { isModelAvailableInServer } from "@/app/utils/model";
|
|
||||||
|
|
||||||
const serverConfig = getServerSideConfig();
|
|
||||||
|
|
||||||
export async function handle(
|
|
||||||
req: NextRequest,
|
|
||||||
{ params }: { params: { path: string[] } },
|
|
||||||
) {
|
|
||||||
console.log("[GLM Route] params ", params);
|
|
||||||
|
|
||||||
if (req.method === "OPTIONS") {
|
|
||||||
return NextResponse.json({ body: "OK" }, { status: 200 });
|
|
||||||
}
|
|
||||||
|
|
||||||
const authResult = auth(req, ModelProvider.ChatGLM);
|
|
||||||
if (authResult.error) {
|
|
||||||
return NextResponse.json(authResult, {
|
|
||||||
status: 401,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await request(req);
|
|
||||||
return response;
|
|
||||||
} catch (e) {
|
|
||||||
console.error("[GLM] ", e);
|
|
||||||
return NextResponse.json(prettyObject(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function request(req: NextRequest) {
|
|
||||||
const controller = new AbortController();
|
|
||||||
|
|
||||||
// alibaba use base url or just remove the path
|
|
||||||
let path = `${req.nextUrl.pathname}`.replaceAll(ApiPath.ChatGLM, "");
|
|
||||||
|
|
||||||
let baseUrl = serverConfig.chatglmUrl || CHATGLM_BASE_URL;
|
|
||||||
|
|
||||||
if (!baseUrl.startsWith("http")) {
|
|
||||||
baseUrl = `https://${baseUrl}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (baseUrl.endsWith("/")) {
|
|
||||||
baseUrl = baseUrl.slice(0, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("[Proxy] ", path);
|
|
||||||
console.log("[Base Url]", baseUrl);
|
|
||||||
|
|
||||||
const timeoutId = setTimeout(
|
|
||||||
() => {
|
|
||||||
controller.abort();
|
|
||||||
},
|
|
||||||
10 * 60 * 1000,
|
|
||||||
);
|
|
||||||
|
|
||||||
const fetchUrl = `${baseUrl}${path}`;
|
|
||||||
console.log("[Fetch Url] ", fetchUrl);
|
|
||||||
const fetchOptions: RequestInit = {
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
Authorization: req.headers.get("Authorization") ?? "",
|
|
||||||
},
|
|
||||||
method: req.method,
|
|
||||||
body: req.body,
|
|
||||||
redirect: "manual",
|
|
||||||
// @ts-ignore
|
|
||||||
duplex: "half",
|
|
||||||
signal: controller.signal,
|
|
||||||
};
|
|
||||||
|
|
||||||
// #1815 try to refuse some request to some models
|
|
||||||
if (serverConfig.customModels && req.body) {
|
|
||||||
try {
|
|
||||||
const clonedBody = await req.text();
|
|
||||||
fetchOptions.body = clonedBody;
|
|
||||||
|
|
||||||
const jsonBody = JSON.parse(clonedBody) as { model?: string };
|
|
||||||
|
|
||||||
// not undefined and is false
|
|
||||||
if (
|
|
||||||
isModelAvailableInServer(
|
|
||||||
serverConfig.customModels,
|
|
||||||
jsonBody?.model as string,
|
|
||||||
ServiceProvider.ChatGLM as string,
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
return NextResponse.json(
|
|
||||||
{
|
|
||||||
error: true,
|
|
||||||
message: `you are not allowed to use ${jsonBody?.model} model`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
status: 403,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error(`[GLM] filter`, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const res = await fetch(fetchUrl, fetchOptions);
|
|
||||||
|
|
||||||
// to prevent browser prompt for credentials
|
|
||||||
const newHeaders = new Headers(res.headers);
|
|
||||||
newHeaders.delete("www-authenticate");
|
|
||||||
// to disable nginx buffering
|
|
||||||
newHeaders.set("X-Accel-Buffering", "no");
|
|
||||||
|
|
||||||
return new Response(res.body, {
|
|
||||||
status: res.status,
|
|
||||||
statusText: res.statusText,
|
|
||||||
headers: newHeaders,
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
clearTimeout(timeoutId);
|
|
||||||
}
|
|
||||||
}
|
|
128
app/api/xai.ts
128
app/api/xai.ts
@@ -1,128 +0,0 @@
|
|||||||
import { getServerSideConfig } from "@/app/config/server";
|
|
||||||
import {
|
|
||||||
XAI_BASE_URL,
|
|
||||||
ApiPath,
|
|
||||||
ModelProvider,
|
|
||||||
ServiceProvider,
|
|
||||||
} from "@/app/constant";
|
|
||||||
import { prettyObject } from "@/app/utils/format";
|
|
||||||
import { NextRequest, NextResponse } from "next/server";
|
|
||||||
import { auth } from "@/app/api/auth";
|
|
||||||
import { isModelAvailableInServer } from "@/app/utils/model";
|
|
||||||
|
|
||||||
const serverConfig = getServerSideConfig();
|
|
||||||
|
|
||||||
export async function handle(
|
|
||||||
req: NextRequest,
|
|
||||||
{ params }: { params: { path: string[] } },
|
|
||||||
) {
|
|
||||||
console.log("[XAI Route] params ", params);
|
|
||||||
|
|
||||||
if (req.method === "OPTIONS") {
|
|
||||||
return NextResponse.json({ body: "OK" }, { status: 200 });
|
|
||||||
}
|
|
||||||
|
|
||||||
const authResult = auth(req, ModelProvider.XAI);
|
|
||||||
if (authResult.error) {
|
|
||||||
return NextResponse.json(authResult, {
|
|
||||||
status: 401,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await request(req);
|
|
||||||
return response;
|
|
||||||
} catch (e) {
|
|
||||||
console.error("[XAI] ", e);
|
|
||||||
return NextResponse.json(prettyObject(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function request(req: NextRequest) {
|
|
||||||
const controller = new AbortController();
|
|
||||||
|
|
||||||
// alibaba use base url or just remove the path
|
|
||||||
let path = `${req.nextUrl.pathname}`.replaceAll(ApiPath.XAI, "");
|
|
||||||
|
|
||||||
let baseUrl = serverConfig.xaiUrl || XAI_BASE_URL;
|
|
||||||
|
|
||||||
if (!baseUrl.startsWith("http")) {
|
|
||||||
baseUrl = `https://${baseUrl}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (baseUrl.endsWith("/")) {
|
|
||||||
baseUrl = baseUrl.slice(0, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("[Proxy] ", path);
|
|
||||||
console.log("[Base Url]", baseUrl);
|
|
||||||
|
|
||||||
const timeoutId = setTimeout(
|
|
||||||
() => {
|
|
||||||
controller.abort();
|
|
||||||
},
|
|
||||||
10 * 60 * 1000,
|
|
||||||
);
|
|
||||||
|
|
||||||
const fetchUrl = `${baseUrl}${path}`;
|
|
||||||
const fetchOptions: RequestInit = {
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
Authorization: req.headers.get("Authorization") ?? "",
|
|
||||||
},
|
|
||||||
method: req.method,
|
|
||||||
body: req.body,
|
|
||||||
redirect: "manual",
|
|
||||||
// @ts-ignore
|
|
||||||
duplex: "half",
|
|
||||||
signal: controller.signal,
|
|
||||||
};
|
|
||||||
|
|
||||||
// #1815 try to refuse some request to some models
|
|
||||||
if (serverConfig.customModels && req.body) {
|
|
||||||
try {
|
|
||||||
const clonedBody = await req.text();
|
|
||||||
fetchOptions.body = clonedBody;
|
|
||||||
|
|
||||||
const jsonBody = JSON.parse(clonedBody) as { model?: string };
|
|
||||||
|
|
||||||
// not undefined and is false
|
|
||||||
if (
|
|
||||||
isModelAvailableInServer(
|
|
||||||
serverConfig.customModels,
|
|
||||||
jsonBody?.model as string,
|
|
||||||
ServiceProvider.XAI as string,
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
return NextResponse.json(
|
|
||||||
{
|
|
||||||
error: true,
|
|
||||||
message: `you are not allowed to use ${jsonBody?.model} model`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
status: 403,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error(`[XAI] filter`, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const res = await fetch(fetchUrl, fetchOptions);
|
|
||||||
|
|
||||||
// to prevent browser prompt for credentials
|
|
||||||
const newHeaders = new Headers(res.headers);
|
|
||||||
newHeaders.delete("www-authenticate");
|
|
||||||
// to disable nginx buffering
|
|
||||||
newHeaders.set("X-Accel-Buffering", "no");
|
|
||||||
|
|
||||||
return new Response(res.body, {
|
|
||||||
status: res.status,
|
|
||||||
statusText: res.statusText,
|
|
||||||
headers: newHeaders,
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
clearTimeout(timeoutId);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -20,8 +20,6 @@ import { QwenApi } from "./platforms/alibaba";
|
|||||||
import { HunyuanApi } from "./platforms/tencent";
|
import { HunyuanApi } from "./platforms/tencent";
|
||||||
import { MoonshotApi } from "./platforms/moonshot";
|
import { MoonshotApi } from "./platforms/moonshot";
|
||||||
import { SparkApi } from "./platforms/iflytek";
|
import { SparkApi } from "./platforms/iflytek";
|
||||||
import { XAIApi } from "./platforms/xai";
|
|
||||||
import { ChatGLMApi } from "./platforms/glm";
|
|
||||||
|
|
||||||
export const ROLES = ["system", "user", "assistant"] as const;
|
export const ROLES = ["system", "user", "assistant"] as const;
|
||||||
export type MessageRole = (typeof ROLES)[number];
|
export type MessageRole = (typeof ROLES)[number];
|
||||||
@@ -70,7 +68,7 @@ export interface ChatOptions {
|
|||||||
config: LLMConfig;
|
config: LLMConfig;
|
||||||
|
|
||||||
onUpdate?: (message: string, chunk: string) => void;
|
onUpdate?: (message: string, chunk: string) => void;
|
||||||
onFinish: (message: string, responseRes: Response) => void;
|
onFinish: (message: string) => void;
|
||||||
onError?: (err: Error) => void;
|
onError?: (err: Error) => void;
|
||||||
onController?: (controller: AbortController) => void;
|
onController?: (controller: AbortController) => void;
|
||||||
onBeforeTool?: (tool: ChatMessageTool) => void;
|
onBeforeTool?: (tool: ChatMessageTool) => void;
|
||||||
@@ -154,12 +152,6 @@ export class ClientApi {
|
|||||||
case ModelProvider.Iflytek:
|
case ModelProvider.Iflytek:
|
||||||
this.llm = new SparkApi();
|
this.llm = new SparkApi();
|
||||||
break;
|
break;
|
||||||
case ModelProvider.XAI:
|
|
||||||
this.llm = new XAIApi();
|
|
||||||
break;
|
|
||||||
case ModelProvider.ChatGLM:
|
|
||||||
this.llm = new ChatGLMApi();
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
this.llm = new ChatGPTApi();
|
this.llm = new ChatGPTApi();
|
||||||
}
|
}
|
||||||
@@ -247,8 +239,6 @@ export function getHeaders(ignoreHeaders: boolean = false) {
|
|||||||
const isAlibaba = modelConfig.providerName === ServiceProvider.Alibaba;
|
const isAlibaba = modelConfig.providerName === ServiceProvider.Alibaba;
|
||||||
const isMoonshot = modelConfig.providerName === ServiceProvider.Moonshot;
|
const isMoonshot = modelConfig.providerName === ServiceProvider.Moonshot;
|
||||||
const isIflytek = modelConfig.providerName === ServiceProvider.Iflytek;
|
const isIflytek = modelConfig.providerName === ServiceProvider.Iflytek;
|
||||||
const isXAI = modelConfig.providerName === ServiceProvider.XAI;
|
|
||||||
const isChatGLM = modelConfig.providerName === ServiceProvider.ChatGLM;
|
|
||||||
const isEnabledAccessControl = accessStore.enabledAccessControl();
|
const isEnabledAccessControl = accessStore.enabledAccessControl();
|
||||||
const apiKey = isGoogle
|
const apiKey = isGoogle
|
||||||
? accessStore.googleApiKey
|
? accessStore.googleApiKey
|
||||||
@@ -262,10 +252,6 @@ export function getHeaders(ignoreHeaders: boolean = false) {
|
|||||||
? accessStore.alibabaApiKey
|
? accessStore.alibabaApiKey
|
||||||
: isMoonshot
|
: isMoonshot
|
||||||
? accessStore.moonshotApiKey
|
? accessStore.moonshotApiKey
|
||||||
: isXAI
|
|
||||||
? accessStore.xaiApiKey
|
|
||||||
: isChatGLM
|
|
||||||
? accessStore.chatglmApiKey
|
|
||||||
: isIflytek
|
: isIflytek
|
||||||
? accessStore.iflytekApiKey && accessStore.iflytekApiSecret
|
? accessStore.iflytekApiKey && accessStore.iflytekApiSecret
|
||||||
? accessStore.iflytekApiKey + ":" + accessStore.iflytekApiSecret
|
? accessStore.iflytekApiKey + ":" + accessStore.iflytekApiSecret
|
||||||
@@ -280,8 +266,6 @@ export function getHeaders(ignoreHeaders: boolean = false) {
|
|||||||
isAlibaba,
|
isAlibaba,
|
||||||
isMoonshot,
|
isMoonshot,
|
||||||
isIflytek,
|
isIflytek,
|
||||||
isXAI,
|
|
||||||
isChatGLM,
|
|
||||||
apiKey,
|
apiKey,
|
||||||
isEnabledAccessControl,
|
isEnabledAccessControl,
|
||||||
};
|
};
|
||||||
@@ -344,10 +328,6 @@ export function getClientApi(provider: ServiceProvider): ClientApi {
|
|||||||
return new ClientApi(ModelProvider.Moonshot);
|
return new ClientApi(ModelProvider.Moonshot);
|
||||||
case ServiceProvider.Iflytek:
|
case ServiceProvider.Iflytek:
|
||||||
return new ClientApi(ModelProvider.Iflytek);
|
return new ClientApi(ModelProvider.Iflytek);
|
||||||
case ServiceProvider.XAI:
|
|
||||||
return new ClientApi(ModelProvider.XAI);
|
|
||||||
case ServiceProvider.ChatGLM:
|
|
||||||
return new ClientApi(ModelProvider.ChatGLM);
|
|
||||||
default:
|
default:
|
||||||
return new ClientApi(ModelProvider.GPT);
|
return new ClientApi(ModelProvider.GPT);
|
||||||
}
|
}
|
||||||
|
@@ -143,7 +143,6 @@ export class QwenApi implements LLMApi {
|
|||||||
let responseText = "";
|
let responseText = "";
|
||||||
let remainText = "";
|
let remainText = "";
|
||||||
let finished = false;
|
let finished = false;
|
||||||
let responseRes: Response;
|
|
||||||
|
|
||||||
// animate response to make it looks smooth
|
// animate response to make it looks smooth
|
||||||
function animateResponseText() {
|
function animateResponseText() {
|
||||||
@@ -173,7 +172,7 @@ export class QwenApi implements LLMApi {
|
|||||||
const finish = () => {
|
const finish = () => {
|
||||||
if (!finished) {
|
if (!finished) {
|
||||||
finished = true;
|
finished = true;
|
||||||
options.onFinish(responseText + remainText, responseRes);
|
options.onFinish(responseText + remainText);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -189,7 +188,6 @@ export class QwenApi implements LLMApi {
|
|||||||
"[Alibaba] request response content type: ",
|
"[Alibaba] request response content type: ",
|
||||||
contentType,
|
contentType,
|
||||||
);
|
);
|
||||||
responseRes = res;
|
|
||||||
|
|
||||||
if (contentType?.startsWith("text/plain")) {
|
if (contentType?.startsWith("text/plain")) {
|
||||||
responseText = await res.clone().text();
|
responseText = await res.clone().text();
|
||||||
@@ -256,7 +254,7 @@ export class QwenApi implements LLMApi {
|
|||||||
|
|
||||||
const resJson = await res.json();
|
const resJson = await res.json();
|
||||||
const message = this.extractMessage(resJson);
|
const message = this.extractMessage(resJson);
|
||||||
options.onFinish(message, res);
|
options.onFinish(message);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("[Request] failed to make a chat request", e);
|
console.log("[Request] failed to make a chat request", e);
|
||||||
|
@@ -13,7 +13,6 @@ import { getMessageTextContent, isVisionModel } from "@/app/utils";
|
|||||||
import { preProcessImageContent, stream } from "@/app/utils/chat";
|
import { preProcessImageContent, stream } from "@/app/utils/chat";
|
||||||
import { cloudflareAIGatewayUrl } from "@/app/utils/cloudflare";
|
import { cloudflareAIGatewayUrl } from "@/app/utils/cloudflare";
|
||||||
import { RequestPayload } from "./openai";
|
import { RequestPayload } from "./openai";
|
||||||
import { fetch } from "@/app/utils/stream";
|
|
||||||
|
|
||||||
export type MultiBlockContent = {
|
export type MultiBlockContent = {
|
||||||
type: "image" | "text";
|
type: "image" | "text";
|
||||||
@@ -317,14 +316,13 @@ export class ClaudeApi implements LLMApi {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
controller.signal.onabort = () =>
|
controller.signal.onabort = () => options.onFinish("");
|
||||||
options.onFinish("", new Response(null, { status: 400 }));
|
|
||||||
|
|
||||||
const res = await fetch(path, payload);
|
const res = await fetch(path, payload);
|
||||||
const resJson = await res.json();
|
const resJson = await res.json();
|
||||||
|
|
||||||
const message = this.extractMessage(resJson);
|
const message = this.extractMessage(resJson);
|
||||||
options.onFinish(message, res);
|
options.onFinish(message);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("failed to chat", e);
|
console.error("failed to chat", e);
|
||||||
options.onError?.(e as Error);
|
options.onError?.(e as Error);
|
||||||
|
@@ -162,7 +162,6 @@ export class ErnieApi implements LLMApi {
|
|||||||
let responseText = "";
|
let responseText = "";
|
||||||
let remainText = "";
|
let remainText = "";
|
||||||
let finished = false;
|
let finished = false;
|
||||||
let responseRes: Response;
|
|
||||||
|
|
||||||
// animate response to make it looks smooth
|
// animate response to make it looks smooth
|
||||||
function animateResponseText() {
|
function animateResponseText() {
|
||||||
@@ -192,7 +191,7 @@ export class ErnieApi implements LLMApi {
|
|||||||
const finish = () => {
|
const finish = () => {
|
||||||
if (!finished) {
|
if (!finished) {
|
||||||
finished = true;
|
finished = true;
|
||||||
options.onFinish(responseText + remainText, responseRes);
|
options.onFinish(responseText + remainText);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -205,7 +204,7 @@ export class ErnieApi implements LLMApi {
|
|||||||
clearTimeout(requestTimeoutId);
|
clearTimeout(requestTimeoutId);
|
||||||
const contentType = res.headers.get("content-type");
|
const contentType = res.headers.get("content-type");
|
||||||
console.log("[Baidu] request response content type: ", contentType);
|
console.log("[Baidu] request response content type: ", contentType);
|
||||||
responseRes = res;
|
|
||||||
if (contentType?.startsWith("text/plain")) {
|
if (contentType?.startsWith("text/plain")) {
|
||||||
responseText = await res.clone().text();
|
responseText = await res.clone().text();
|
||||||
return finish();
|
return finish();
|
||||||
@@ -268,7 +267,7 @@ export class ErnieApi implements LLMApi {
|
|||||||
|
|
||||||
const resJson = await res.json();
|
const resJson = await res.json();
|
||||||
const message = resJson?.result;
|
const message = resJson?.result;
|
||||||
options.onFinish(message, res);
|
options.onFinish(message);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("[Request] failed to make a chat request", e);
|
console.log("[Request] failed to make a chat request", e);
|
||||||
|
@@ -130,7 +130,6 @@ export class DoubaoApi implements LLMApi {
|
|||||||
let responseText = "";
|
let responseText = "";
|
||||||
let remainText = "";
|
let remainText = "";
|
||||||
let finished = false;
|
let finished = false;
|
||||||
let responseRes: Response;
|
|
||||||
|
|
||||||
// animate response to make it looks smooth
|
// animate response to make it looks smooth
|
||||||
function animateResponseText() {
|
function animateResponseText() {
|
||||||
@@ -160,7 +159,7 @@ export class DoubaoApi implements LLMApi {
|
|||||||
const finish = () => {
|
const finish = () => {
|
||||||
if (!finished) {
|
if (!finished) {
|
||||||
finished = true;
|
finished = true;
|
||||||
options.onFinish(responseText + remainText, responseRes);
|
options.onFinish(responseText + remainText);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -176,7 +175,7 @@ export class DoubaoApi implements LLMApi {
|
|||||||
"[ByteDance] request response content type: ",
|
"[ByteDance] request response content type: ",
|
||||||
contentType,
|
contentType,
|
||||||
);
|
);
|
||||||
responseRes = res;
|
|
||||||
if (contentType?.startsWith("text/plain")) {
|
if (contentType?.startsWith("text/plain")) {
|
||||||
responseText = await res.clone().text();
|
responseText = await res.clone().text();
|
||||||
return finish();
|
return finish();
|
||||||
@@ -242,7 +241,7 @@ export class DoubaoApi implements LLMApi {
|
|||||||
|
|
||||||
const resJson = await res.json();
|
const resJson = await res.json();
|
||||||
const message = this.extractMessage(resJson);
|
const message = this.extractMessage(resJson);
|
||||||
options.onFinish(message, res);
|
options.onFinish(message);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("[Request] failed to make a chat request", e);
|
console.log("[Request] failed to make a chat request", e);
|
||||||
|
@@ -1,197 +0,0 @@
|
|||||||
"use client";
|
|
||||||
import {
|
|
||||||
ApiPath,
|
|
||||||
CHATGLM_BASE_URL,
|
|
||||||
ChatGLM,
|
|
||||||
REQUEST_TIMEOUT_MS,
|
|
||||||
} from "@/app/constant";
|
|
||||||
import {
|
|
||||||
useAccessStore,
|
|
||||||
useAppConfig,
|
|
||||||
useChatStore,
|
|
||||||
ChatMessageTool,
|
|
||||||
usePluginStore,
|
|
||||||
} from "@/app/store";
|
|
||||||
import { stream } from "@/app/utils/chat";
|
|
||||||
import {
|
|
||||||
ChatOptions,
|
|
||||||
getHeaders,
|
|
||||||
LLMApi,
|
|
||||||
LLMModel,
|
|
||||||
SpeechOptions,
|
|
||||||
} from "../api";
|
|
||||||
import { getClientConfig } from "@/app/config/client";
|
|
||||||
import { getMessageTextContent } from "@/app/utils";
|
|
||||||
import { RequestPayload } from "./openai";
|
|
||||||
import { fetch } from "@/app/utils/stream";
|
|
||||||
|
|
||||||
export class ChatGLMApi implements LLMApi {
|
|
||||||
private disableListModels = true;
|
|
||||||
|
|
||||||
path(path: string): string {
|
|
||||||
const accessStore = useAccessStore.getState();
|
|
||||||
|
|
||||||
let baseUrl = "";
|
|
||||||
|
|
||||||
if (accessStore.useCustomConfig) {
|
|
||||||
baseUrl = accessStore.chatglmUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (baseUrl.length === 0) {
|
|
||||||
const isApp = !!getClientConfig()?.isApp;
|
|
||||||
const apiPath = ApiPath.ChatGLM;
|
|
||||||
baseUrl = isApp ? CHATGLM_BASE_URL : apiPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (baseUrl.endsWith("/")) {
|
|
||||||
baseUrl = baseUrl.slice(0, baseUrl.length - 1);
|
|
||||||
}
|
|
||||||
if (!baseUrl.startsWith("http") && !baseUrl.startsWith(ApiPath.ChatGLM)) {
|
|
||||||
baseUrl = "https://" + baseUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("[Proxy Endpoint] ", baseUrl, path);
|
|
||||||
|
|
||||||
return [baseUrl, path].join("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
extractMessage(res: any) {
|
|
||||||
return res.choices?.at(0)?.message?.content ?? "";
|
|
||||||
}
|
|
||||||
|
|
||||||
speech(options: SpeechOptions): Promise<ArrayBuffer> {
|
|
||||||
throw new Error("Method not implemented.");
|
|
||||||
}
|
|
||||||
|
|
||||||
async chat(options: ChatOptions) {
|
|
||||||
const messages: ChatOptions["messages"] = [];
|
|
||||||
for (const v of options.messages) {
|
|
||||||
const content = getMessageTextContent(v);
|
|
||||||
messages.push({ role: v.role, content });
|
|
||||||
}
|
|
||||||
|
|
||||||
const modelConfig = {
|
|
||||||
...useAppConfig.getState().modelConfig,
|
|
||||||
...useChatStore.getState().currentSession().mask.modelConfig,
|
|
||||||
...{
|
|
||||||
model: options.config.model,
|
|
||||||
providerName: options.config.providerName,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const requestPayload: RequestPayload = {
|
|
||||||
messages,
|
|
||||||
stream: options.config.stream,
|
|
||||||
model: modelConfig.model,
|
|
||||||
temperature: modelConfig.temperature,
|
|
||||||
presence_penalty: modelConfig.presence_penalty,
|
|
||||||
frequency_penalty: modelConfig.frequency_penalty,
|
|
||||||
top_p: modelConfig.top_p,
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log("[Request] glm payload: ", requestPayload);
|
|
||||||
|
|
||||||
const shouldStream = !!options.config.stream;
|
|
||||||
const controller = new AbortController();
|
|
||||||
options.onController?.(controller);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const chatPath = this.path(ChatGLM.ChatPath);
|
|
||||||
const chatPayload = {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify(requestPayload),
|
|
||||||
signal: controller.signal,
|
|
||||||
headers: getHeaders(),
|
|
||||||
};
|
|
||||||
|
|
||||||
// make a fetch request
|
|
||||||
const requestTimeoutId = setTimeout(
|
|
||||||
() => controller.abort(),
|
|
||||||
REQUEST_TIMEOUT_MS,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (shouldStream) {
|
|
||||||
const [tools, funcs] = usePluginStore
|
|
||||||
.getState()
|
|
||||||
.getAsTools(
|
|
||||||
useChatStore.getState().currentSession().mask?.plugin || [],
|
|
||||||
);
|
|
||||||
return stream(
|
|
||||||
chatPath,
|
|
||||||
requestPayload,
|
|
||||||
getHeaders(),
|
|
||||||
tools as any,
|
|
||||||
funcs,
|
|
||||||
controller,
|
|
||||||
// parseSSE
|
|
||||||
(text: string, runTools: ChatMessageTool[]) => {
|
|
||||||
// console.log("parseSSE", text, runTools);
|
|
||||||
const json = JSON.parse(text);
|
|
||||||
const choices = json.choices as Array<{
|
|
||||||
delta: {
|
|
||||||
content: string;
|
|
||||||
tool_calls: ChatMessageTool[];
|
|
||||||
};
|
|
||||||
}>;
|
|
||||||
const tool_calls = choices[0]?.delta?.tool_calls;
|
|
||||||
if (tool_calls?.length > 0) {
|
|
||||||
const index = tool_calls[0]?.index;
|
|
||||||
const id = tool_calls[0]?.id;
|
|
||||||
const args = tool_calls[0]?.function?.arguments;
|
|
||||||
if (id) {
|
|
||||||
runTools.push({
|
|
||||||
id,
|
|
||||||
type: tool_calls[0]?.type,
|
|
||||||
function: {
|
|
||||||
name: tool_calls[0]?.function?.name as string,
|
|
||||||
arguments: args,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// @ts-ignore
|
|
||||||
runTools[index]["function"]["arguments"] += args;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return choices[0]?.delta?.content;
|
|
||||||
},
|
|
||||||
// processToolMessage, include tool_calls message and tool call results
|
|
||||||
(
|
|
||||||
requestPayload: RequestPayload,
|
|
||||||
toolCallMessage: any,
|
|
||||||
toolCallResult: any[],
|
|
||||||
) => {
|
|
||||||
// @ts-ignore
|
|
||||||
requestPayload?.messages?.splice(
|
|
||||||
// @ts-ignore
|
|
||||||
requestPayload?.messages?.length,
|
|
||||||
0,
|
|
||||||
toolCallMessage,
|
|
||||||
...toolCallResult,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
const res = await fetch(chatPath, chatPayload);
|
|
||||||
clearTimeout(requestTimeoutId);
|
|
||||||
|
|
||||||
const resJson = await res.json();
|
|
||||||
const message = this.extractMessage(resJson);
|
|
||||||
options.onFinish(message, res);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log("[Request] failed to make a chat request", e);
|
|
||||||
options.onError?.(e as Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async usage() {
|
|
||||||
return {
|
|
||||||
used: 0,
|
|
||||||
total: 0,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
async models(): Promise<LLMModel[]> {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -192,10 +192,7 @@ export class GeminiProApi implements LLMApi {
|
|||||||
requestPayload,
|
requestPayload,
|
||||||
getHeaders(),
|
getHeaders(),
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
tools.length > 0
|
[{ functionDeclarations: tools.map((tool) => tool.function) }],
|
||||||
? // @ts-ignore
|
|
||||||
[{ functionDeclarations: tools.map((tool) => tool.function) }]
|
|
||||||
: [],
|
|
||||||
funcs,
|
funcs,
|
||||||
controller,
|
controller,
|
||||||
// parseSSE
|
// parseSSE
|
||||||
@@ -274,7 +271,7 @@ export class GeminiProApi implements LLMApi {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
const message = apiClient.extractMessage(resJson);
|
const message = apiClient.extractMessage(resJson);
|
||||||
options.onFinish(message, res);
|
options.onFinish(message);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("[Request] failed to make a chat request", e);
|
console.log("[Request] failed to make a chat request", e);
|
||||||
|
@@ -117,7 +117,6 @@ export class SparkApi implements LLMApi {
|
|||||||
let responseText = "";
|
let responseText = "";
|
||||||
let remainText = "";
|
let remainText = "";
|
||||||
let finished = false;
|
let finished = false;
|
||||||
let responseRes: Response;
|
|
||||||
|
|
||||||
// Animate response text to make it look smooth
|
// Animate response text to make it look smooth
|
||||||
function animateResponseText() {
|
function animateResponseText() {
|
||||||
@@ -144,7 +143,7 @@ export class SparkApi implements LLMApi {
|
|||||||
const finish = () => {
|
const finish = () => {
|
||||||
if (!finished) {
|
if (!finished) {
|
||||||
finished = true;
|
finished = true;
|
||||||
options.onFinish(responseText + remainText, responseRes);
|
options.onFinish(responseText + remainText);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -157,7 +156,7 @@ export class SparkApi implements LLMApi {
|
|||||||
clearTimeout(requestTimeoutId);
|
clearTimeout(requestTimeoutId);
|
||||||
const contentType = res.headers.get("content-type");
|
const contentType = res.headers.get("content-type");
|
||||||
console.log("[Spark] request response content type: ", contentType);
|
console.log("[Spark] request response content type: ", contentType);
|
||||||
responseRes = res;
|
|
||||||
if (contentType?.startsWith("text/plain")) {
|
if (contentType?.startsWith("text/plain")) {
|
||||||
responseText = await res.clone().text();
|
responseText = await res.clone().text();
|
||||||
return finish();
|
return finish();
|
||||||
@@ -232,7 +231,7 @@ export class SparkApi implements LLMApi {
|
|||||||
|
|
||||||
const resJson = await res.json();
|
const resJson = await res.json();
|
||||||
const message = this.extractMessage(resJson);
|
const message = this.extractMessage(resJson);
|
||||||
options.onFinish(message, res);
|
options.onFinish(message);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("[Request] failed to make a chat request", e);
|
console.log("[Request] failed to make a chat request", e);
|
||||||
|
@@ -24,7 +24,6 @@ import {
|
|||||||
import { getClientConfig } from "@/app/config/client";
|
import { getClientConfig } from "@/app/config/client";
|
||||||
import { getMessageTextContent } from "@/app/utils";
|
import { getMessageTextContent } from "@/app/utils";
|
||||||
import { RequestPayload } from "./openai";
|
import { RequestPayload } from "./openai";
|
||||||
import { fetch } from "@/app/utils/stream";
|
|
||||||
|
|
||||||
export class MoonshotApi implements LLMApi {
|
export class MoonshotApi implements LLMApi {
|
||||||
private disableListModels = true;
|
private disableListModels = true;
|
||||||
@@ -180,7 +179,7 @@ export class MoonshotApi implements LLMApi {
|
|||||||
|
|
||||||
const resJson = await res.json();
|
const resJson = await res.json();
|
||||||
const message = this.extractMessage(resJson);
|
const message = this.extractMessage(resJson);
|
||||||
options.onFinish(message, res);
|
options.onFinish(message);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("[Request] failed to make a chat request", e);
|
console.log("[Request] failed to make a chat request", e);
|
||||||
|
@@ -42,7 +42,6 @@ import {
|
|||||||
isVisionModel,
|
isVisionModel,
|
||||||
isDalle3 as _isDalle3,
|
isDalle3 as _isDalle3,
|
||||||
} from "@/app/utils";
|
} from "@/app/utils";
|
||||||
import { fetch } from "@/app/utils/stream";
|
|
||||||
|
|
||||||
export interface OpenAIListModelResponse {
|
export interface OpenAIListModelResponse {
|
||||||
object: string;
|
object: string;
|
||||||
@@ -361,7 +360,7 @@ export class ChatGPTApi implements LLMApi {
|
|||||||
|
|
||||||
const resJson = await res.json();
|
const resJson = await res.json();
|
||||||
const message = await this.extractMessage(resJson);
|
const message = await this.extractMessage(resJson);
|
||||||
options.onFinish(message, res);
|
options.onFinish(message);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("[Request] failed to make a chat request", e);
|
console.log("[Request] failed to make a chat request", e);
|
||||||
|
@@ -142,7 +142,6 @@ export class HunyuanApi implements LLMApi {
|
|||||||
let responseText = "";
|
let responseText = "";
|
||||||
let remainText = "";
|
let remainText = "";
|
||||||
let finished = false;
|
let finished = false;
|
||||||
let responseRes: Response;
|
|
||||||
|
|
||||||
// animate response to make it looks smooth
|
// animate response to make it looks smooth
|
||||||
function animateResponseText() {
|
function animateResponseText() {
|
||||||
@@ -172,7 +171,7 @@ export class HunyuanApi implements LLMApi {
|
|||||||
const finish = () => {
|
const finish = () => {
|
||||||
if (!finished) {
|
if (!finished) {
|
||||||
finished = true;
|
finished = true;
|
||||||
options.onFinish(responseText + remainText, responseRes);
|
options.onFinish(responseText + remainText);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -188,7 +187,7 @@ export class HunyuanApi implements LLMApi {
|
|||||||
"[Tencent] request response content type: ",
|
"[Tencent] request response content type: ",
|
||||||
contentType,
|
contentType,
|
||||||
);
|
);
|
||||||
responseRes = res;
|
|
||||||
if (contentType?.startsWith("text/plain")) {
|
if (contentType?.startsWith("text/plain")) {
|
||||||
responseText = await res.clone().text();
|
responseText = await res.clone().text();
|
||||||
return finish();
|
return finish();
|
||||||
@@ -254,7 +253,7 @@ export class HunyuanApi implements LLMApi {
|
|||||||
|
|
||||||
const resJson = await res.json();
|
const resJson = await res.json();
|
||||||
const message = this.extractMessage(resJson);
|
const message = this.extractMessage(resJson);
|
||||||
options.onFinish(message, res);
|
options.onFinish(message);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("[Request] failed to make a chat request", e);
|
console.log("[Request] failed to make a chat request", e);
|
||||||
|
@@ -1,193 +0,0 @@
|
|||||||
"use client";
|
|
||||||
// azure and openai, using same models. so using same LLMApi.
|
|
||||||
import { ApiPath, XAI_BASE_URL, XAI, REQUEST_TIMEOUT_MS } from "@/app/constant";
|
|
||||||
import {
|
|
||||||
useAccessStore,
|
|
||||||
useAppConfig,
|
|
||||||
useChatStore,
|
|
||||||
ChatMessageTool,
|
|
||||||
usePluginStore,
|
|
||||||
} from "@/app/store";
|
|
||||||
import { stream } from "@/app/utils/chat";
|
|
||||||
import {
|
|
||||||
ChatOptions,
|
|
||||||
getHeaders,
|
|
||||||
LLMApi,
|
|
||||||
LLMModel,
|
|
||||||
SpeechOptions,
|
|
||||||
} from "../api";
|
|
||||||
import { getClientConfig } from "@/app/config/client";
|
|
||||||
import { getMessageTextContent } from "@/app/utils";
|
|
||||||
import { RequestPayload } from "./openai";
|
|
||||||
import { fetch } from "@/app/utils/stream";
|
|
||||||
|
|
||||||
export class XAIApi implements LLMApi {
|
|
||||||
private disableListModels = true;
|
|
||||||
|
|
||||||
path(path: string): string {
|
|
||||||
const accessStore = useAccessStore.getState();
|
|
||||||
|
|
||||||
let baseUrl = "";
|
|
||||||
|
|
||||||
if (accessStore.useCustomConfig) {
|
|
||||||
baseUrl = accessStore.xaiUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (baseUrl.length === 0) {
|
|
||||||
const isApp = !!getClientConfig()?.isApp;
|
|
||||||
const apiPath = ApiPath.XAI;
|
|
||||||
baseUrl = isApp ? XAI_BASE_URL : apiPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (baseUrl.endsWith("/")) {
|
|
||||||
baseUrl = baseUrl.slice(0, baseUrl.length - 1);
|
|
||||||
}
|
|
||||||
if (!baseUrl.startsWith("http") && !baseUrl.startsWith(ApiPath.XAI)) {
|
|
||||||
baseUrl = "https://" + baseUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("[Proxy Endpoint] ", baseUrl, path);
|
|
||||||
|
|
||||||
return [baseUrl, path].join("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
extractMessage(res: any) {
|
|
||||||
return res.choices?.at(0)?.message?.content ?? "";
|
|
||||||
}
|
|
||||||
|
|
||||||
speech(options: SpeechOptions): Promise<ArrayBuffer> {
|
|
||||||
throw new Error("Method not implemented.");
|
|
||||||
}
|
|
||||||
|
|
||||||
async chat(options: ChatOptions) {
|
|
||||||
const messages: ChatOptions["messages"] = [];
|
|
||||||
for (const v of options.messages) {
|
|
||||||
const content = getMessageTextContent(v);
|
|
||||||
messages.push({ role: v.role, content });
|
|
||||||
}
|
|
||||||
|
|
||||||
const modelConfig = {
|
|
||||||
...useAppConfig.getState().modelConfig,
|
|
||||||
...useChatStore.getState().currentSession().mask.modelConfig,
|
|
||||||
...{
|
|
||||||
model: options.config.model,
|
|
||||||
providerName: options.config.providerName,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const requestPayload: RequestPayload = {
|
|
||||||
messages,
|
|
||||||
stream: options.config.stream,
|
|
||||||
model: modelConfig.model,
|
|
||||||
temperature: modelConfig.temperature,
|
|
||||||
presence_penalty: modelConfig.presence_penalty,
|
|
||||||
frequency_penalty: modelConfig.frequency_penalty,
|
|
||||||
top_p: modelConfig.top_p,
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log("[Request] xai payload: ", requestPayload);
|
|
||||||
|
|
||||||
const shouldStream = !!options.config.stream;
|
|
||||||
const controller = new AbortController();
|
|
||||||
options.onController?.(controller);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const chatPath = this.path(XAI.ChatPath);
|
|
||||||
const chatPayload = {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify(requestPayload),
|
|
||||||
signal: controller.signal,
|
|
||||||
headers: getHeaders(),
|
|
||||||
};
|
|
||||||
|
|
||||||
// make a fetch request
|
|
||||||
const requestTimeoutId = setTimeout(
|
|
||||||
() => controller.abort(),
|
|
||||||
REQUEST_TIMEOUT_MS,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (shouldStream) {
|
|
||||||
const [tools, funcs] = usePluginStore
|
|
||||||
.getState()
|
|
||||||
.getAsTools(
|
|
||||||
useChatStore.getState().currentSession().mask?.plugin || [],
|
|
||||||
);
|
|
||||||
return stream(
|
|
||||||
chatPath,
|
|
||||||
requestPayload,
|
|
||||||
getHeaders(),
|
|
||||||
tools as any,
|
|
||||||
funcs,
|
|
||||||
controller,
|
|
||||||
// parseSSE
|
|
||||||
(text: string, runTools: ChatMessageTool[]) => {
|
|
||||||
// console.log("parseSSE", text, runTools);
|
|
||||||
const json = JSON.parse(text);
|
|
||||||
const choices = json.choices as Array<{
|
|
||||||
delta: {
|
|
||||||
content: string;
|
|
||||||
tool_calls: ChatMessageTool[];
|
|
||||||
};
|
|
||||||
}>;
|
|
||||||
const tool_calls = choices[0]?.delta?.tool_calls;
|
|
||||||
if (tool_calls?.length > 0) {
|
|
||||||
const index = tool_calls[0]?.index;
|
|
||||||
const id = tool_calls[0]?.id;
|
|
||||||
const args = tool_calls[0]?.function?.arguments;
|
|
||||||
if (id) {
|
|
||||||
runTools.push({
|
|
||||||
id,
|
|
||||||
type: tool_calls[0]?.type,
|
|
||||||
function: {
|
|
||||||
name: tool_calls[0]?.function?.name as string,
|
|
||||||
arguments: args,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// @ts-ignore
|
|
||||||
runTools[index]["function"]["arguments"] += args;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return choices[0]?.delta?.content;
|
|
||||||
},
|
|
||||||
// processToolMessage, include tool_calls message and tool call results
|
|
||||||
(
|
|
||||||
requestPayload: RequestPayload,
|
|
||||||
toolCallMessage: any,
|
|
||||||
toolCallResult: any[],
|
|
||||||
) => {
|
|
||||||
// @ts-ignore
|
|
||||||
requestPayload?.messages?.splice(
|
|
||||||
// @ts-ignore
|
|
||||||
requestPayload?.messages?.length,
|
|
||||||
0,
|
|
||||||
toolCallMessage,
|
|
||||||
...toolCallResult,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
const res = await fetch(chatPath, chatPayload);
|
|
||||||
clearTimeout(requestTimeoutId);
|
|
||||||
|
|
||||||
const resJson = await res.json();
|
|
||||||
const message = this.extractMessage(resJson);
|
|
||||||
options.onFinish(message, res);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log("[Request] failed to make a chat request", e);
|
|
||||||
options.onError?.(e as Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async usage() {
|
|
||||||
return {
|
|
||||||
used: 0,
|
|
||||||
total: 0,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
async models(): Promise<LLMModel[]> {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1607,7 +1607,7 @@ function _Chat() {
|
|||||||
title={Locale.Chat.Actions.RefreshTitle}
|
title={Locale.Chat.Actions.RefreshTitle}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
showToast(Locale.Chat.Actions.RefreshToast);
|
showToast(Locale.Chat.Actions.RefreshToast);
|
||||||
chatStore.summarizeSession(true, session);
|
chatStore.summarizeSession(true);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -59,7 +59,6 @@ import {
|
|||||||
ByteDance,
|
ByteDance,
|
||||||
Alibaba,
|
Alibaba,
|
||||||
Moonshot,
|
Moonshot,
|
||||||
XAI,
|
|
||||||
Google,
|
Google,
|
||||||
GoogleSafetySettingsThreshold,
|
GoogleSafetySettingsThreshold,
|
||||||
OPENAI_BASE_URL,
|
OPENAI_BASE_URL,
|
||||||
@@ -72,7 +71,6 @@ import {
|
|||||||
Stability,
|
Stability,
|
||||||
Iflytek,
|
Iflytek,
|
||||||
SAAS_CHAT_URL,
|
SAAS_CHAT_URL,
|
||||||
ChatGLM,
|
|
||||||
} from "../constant";
|
} from "../constant";
|
||||||
import { Prompt, SearchService, usePromptStore } from "../store/prompt";
|
import { Prompt, SearchService, usePromptStore } from "../store/prompt";
|
||||||
import { ErrorBoundary } from "./error";
|
import { ErrorBoundary } from "./error";
|
||||||
@@ -1196,86 +1194,6 @@ export function Settings() {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
const XAIConfigComponent = accessStore.provider === ServiceProvider.XAI && (
|
|
||||||
<>
|
|
||||||
<ListItem
|
|
||||||
title={Locale.Settings.Access.XAI.Endpoint.Title}
|
|
||||||
subTitle={
|
|
||||||
Locale.Settings.Access.XAI.Endpoint.SubTitle + XAI.ExampleEndpoint
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
aria-label={Locale.Settings.Access.XAI.Endpoint.Title}
|
|
||||||
type="text"
|
|
||||||
value={accessStore.xaiUrl}
|
|
||||||
placeholder={XAI.ExampleEndpoint}
|
|
||||||
onChange={(e) =>
|
|
||||||
accessStore.update(
|
|
||||||
(access) => (access.xaiUrl = e.currentTarget.value),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
></input>
|
|
||||||
</ListItem>
|
|
||||||
<ListItem
|
|
||||||
title={Locale.Settings.Access.XAI.ApiKey.Title}
|
|
||||||
subTitle={Locale.Settings.Access.XAI.ApiKey.SubTitle}
|
|
||||||
>
|
|
||||||
<PasswordInput
|
|
||||||
aria-label={Locale.Settings.Access.XAI.ApiKey.Title}
|
|
||||||
value={accessStore.xaiApiKey}
|
|
||||||
type="text"
|
|
||||||
placeholder={Locale.Settings.Access.XAI.ApiKey.Placeholder}
|
|
||||||
onChange={(e) => {
|
|
||||||
accessStore.update(
|
|
||||||
(access) => (access.xaiApiKey = e.currentTarget.value),
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</ListItem>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
|
|
||||||
const chatglmConfigComponent = accessStore.provider ===
|
|
||||||
ServiceProvider.ChatGLM && (
|
|
||||||
<>
|
|
||||||
<ListItem
|
|
||||||
title={Locale.Settings.Access.ChatGLM.Endpoint.Title}
|
|
||||||
subTitle={
|
|
||||||
Locale.Settings.Access.ChatGLM.Endpoint.SubTitle +
|
|
||||||
ChatGLM.ExampleEndpoint
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
aria-label={Locale.Settings.Access.ChatGLM.Endpoint.Title}
|
|
||||||
type="text"
|
|
||||||
value={accessStore.chatglmUrl}
|
|
||||||
placeholder={ChatGLM.ExampleEndpoint}
|
|
||||||
onChange={(e) =>
|
|
||||||
accessStore.update(
|
|
||||||
(access) => (access.chatglmUrl = e.currentTarget.value),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
></input>
|
|
||||||
</ListItem>
|
|
||||||
<ListItem
|
|
||||||
title={Locale.Settings.Access.ChatGLM.ApiKey.Title}
|
|
||||||
subTitle={Locale.Settings.Access.ChatGLM.ApiKey.SubTitle}
|
|
||||||
>
|
|
||||||
<PasswordInput
|
|
||||||
aria-label={Locale.Settings.Access.ChatGLM.ApiKey.Title}
|
|
||||||
value={accessStore.chatglmApiKey}
|
|
||||||
type="text"
|
|
||||||
placeholder={Locale.Settings.Access.ChatGLM.ApiKey.Placeholder}
|
|
||||||
onChange={(e) => {
|
|
||||||
accessStore.update(
|
|
||||||
(access) => (access.chatglmApiKey = e.currentTarget.value),
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</ListItem>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
|
|
||||||
const stabilityConfigComponent = accessStore.provider ===
|
const stabilityConfigComponent = accessStore.provider ===
|
||||||
ServiceProvider.Stability && (
|
ServiceProvider.Stability && (
|
||||||
<>
|
<>
|
||||||
@@ -1734,8 +1652,6 @@ export function Settings() {
|
|||||||
{moonshotConfigComponent}
|
{moonshotConfigComponent}
|
||||||
{stabilityConfigComponent}
|
{stabilityConfigComponent}
|
||||||
{lflytekConfigComponent}
|
{lflytekConfigComponent}
|
||||||
{XAIConfigComponent}
|
|
||||||
{chatglmConfigComponent}
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
@@ -71,14 +71,6 @@ declare global {
|
|||||||
IFLYTEK_API_KEY?: string;
|
IFLYTEK_API_KEY?: string;
|
||||||
IFLYTEK_API_SECRET?: string;
|
IFLYTEK_API_SECRET?: string;
|
||||||
|
|
||||||
// xai only
|
|
||||||
XAI_URL?: string;
|
|
||||||
XAI_API_KEY?: string;
|
|
||||||
|
|
||||||
// chatglm only
|
|
||||||
CHATGLM_URL?: string;
|
|
||||||
CHATGLM_API_KEY?: string;
|
|
||||||
|
|
||||||
// custom template for preprocessing user input
|
// custom template for preprocessing user input
|
||||||
DEFAULT_INPUT_TEMPLATE?: string;
|
DEFAULT_INPUT_TEMPLATE?: string;
|
||||||
}
|
}
|
||||||
@@ -154,8 +146,6 @@ export const getServerSideConfig = () => {
|
|||||||
const isAlibaba = !!process.env.ALIBABA_API_KEY;
|
const isAlibaba = !!process.env.ALIBABA_API_KEY;
|
||||||
const isMoonshot = !!process.env.MOONSHOT_API_KEY;
|
const isMoonshot = !!process.env.MOONSHOT_API_KEY;
|
||||||
const isIflytek = !!process.env.IFLYTEK_API_KEY;
|
const isIflytek = !!process.env.IFLYTEK_API_KEY;
|
||||||
const isXAI = !!process.env.XAI_API_KEY;
|
|
||||||
const isChatGLM = !!process.env.CHATGLM_API_KEY;
|
|
||||||
// const apiKeyEnvVar = process.env.OPENAI_API_KEY ?? "";
|
// const apiKeyEnvVar = process.env.OPENAI_API_KEY ?? "";
|
||||||
// const apiKeys = apiKeyEnvVar.split(",").map((v) => v.trim());
|
// const apiKeys = apiKeyEnvVar.split(",").map((v) => v.trim());
|
||||||
// const randomIndex = Math.floor(Math.random() * apiKeys.length);
|
// const randomIndex = Math.floor(Math.random() * apiKeys.length);
|
||||||
@@ -218,14 +208,6 @@ export const getServerSideConfig = () => {
|
|||||||
iflytekApiKey: process.env.IFLYTEK_API_KEY,
|
iflytekApiKey: process.env.IFLYTEK_API_KEY,
|
||||||
iflytekApiSecret: process.env.IFLYTEK_API_SECRET,
|
iflytekApiSecret: process.env.IFLYTEK_API_SECRET,
|
||||||
|
|
||||||
isXAI,
|
|
||||||
xaiUrl: process.env.XAI_URL,
|
|
||||||
xaiApiKey: getApiKey(process.env.XAI_API_KEY),
|
|
||||||
|
|
||||||
isChatGLM,
|
|
||||||
chatglmUrl: process.env.CHATGLM_URL,
|
|
||||||
chatglmApiKey: getApiKey(process.env.CHATGLM_API_KEY),
|
|
||||||
|
|
||||||
cloudflareAccountId: process.env.CLOUDFLARE_ACCOUNT_ID,
|
cloudflareAccountId: process.env.CLOUDFLARE_ACCOUNT_ID,
|
||||||
cloudflareKVNamespaceId: process.env.CLOUDFLARE_KV_NAMESPACE_ID,
|
cloudflareKVNamespaceId: process.env.CLOUDFLARE_KV_NAMESPACE_ID,
|
||||||
cloudflareKVApiKey: getApiKey(process.env.CLOUDFLARE_KV_API_KEY),
|
cloudflareKVApiKey: getApiKey(process.env.CLOUDFLARE_KV_API_KEY),
|
||||||
|
@@ -28,10 +28,6 @@ export const TENCENT_BASE_URL = "https://hunyuan.tencentcloudapi.com";
|
|||||||
export const MOONSHOT_BASE_URL = "https://api.moonshot.cn";
|
export const MOONSHOT_BASE_URL = "https://api.moonshot.cn";
|
||||||
export const IFLYTEK_BASE_URL = "https://spark-api-open.xf-yun.com";
|
export const IFLYTEK_BASE_URL = "https://spark-api-open.xf-yun.com";
|
||||||
|
|
||||||
export const XAI_BASE_URL = "https://api.x.ai";
|
|
||||||
|
|
||||||
export const CHATGLM_BASE_URL = "https://open.bigmodel.cn";
|
|
||||||
|
|
||||||
export const CACHE_URL_PREFIX = "/api/cache";
|
export const CACHE_URL_PREFIX = "/api/cache";
|
||||||
export const UPLOAD_URL = `${CACHE_URL_PREFIX}/upload`;
|
export const UPLOAD_URL = `${CACHE_URL_PREFIX}/upload`;
|
||||||
|
|
||||||
@@ -63,8 +59,6 @@ export enum ApiPath {
|
|||||||
Iflytek = "/api/iflytek",
|
Iflytek = "/api/iflytek",
|
||||||
Stability = "/api/stability",
|
Stability = "/api/stability",
|
||||||
Artifacts = "/api/artifacts",
|
Artifacts = "/api/artifacts",
|
||||||
XAI = "/api/xai",
|
|
||||||
ChatGLM = "/api/chatglm",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum SlotID {
|
export enum SlotID {
|
||||||
@@ -117,8 +111,6 @@ export enum ServiceProvider {
|
|||||||
Moonshot = "Moonshot",
|
Moonshot = "Moonshot",
|
||||||
Stability = "Stability",
|
Stability = "Stability",
|
||||||
Iflytek = "Iflytek",
|
Iflytek = "Iflytek",
|
||||||
XAI = "XAI",
|
|
||||||
ChatGLM = "ChatGLM",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Google API safety settings, see https://ai.google.dev/gemini-api/docs/safety-settings
|
// Google API safety settings, see https://ai.google.dev/gemini-api/docs/safety-settings
|
||||||
@@ -141,8 +133,6 @@ export enum ModelProvider {
|
|||||||
Hunyuan = "Hunyuan",
|
Hunyuan = "Hunyuan",
|
||||||
Moonshot = "Moonshot",
|
Moonshot = "Moonshot",
|
||||||
Iflytek = "Iflytek",
|
Iflytek = "Iflytek",
|
||||||
XAI = "XAI",
|
|
||||||
ChatGLM = "ChatGLM",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Stability = {
|
export const Stability = {
|
||||||
@@ -225,16 +215,6 @@ export const Iflytek = {
|
|||||||
ChatPath: "v1/chat/completions",
|
ChatPath: "v1/chat/completions",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const XAI = {
|
|
||||||
ExampleEndpoint: XAI_BASE_URL,
|
|
||||||
ChatPath: "v1/chat/completions",
|
|
||||||
};
|
|
||||||
|
|
||||||
export const ChatGLM = {
|
|
||||||
ExampleEndpoint: CHATGLM_BASE_URL,
|
|
||||||
ChatPath: "/api/paas/v4/chat/completions",
|
|
||||||
};
|
|
||||||
|
|
||||||
export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang
|
export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang
|
||||||
// export const DEFAULT_SYSTEM_TEMPLATE = `
|
// export const DEFAULT_SYSTEM_TEMPLATE = `
|
||||||
// You are ChatGPT, a large language model trained by {{ServiceProvider}}.
|
// You are ChatGPT, a large language model trained by {{ServiceProvider}}.
|
||||||
@@ -327,12 +307,8 @@ const anthropicModels = [
|
|||||||
"claude-2.1",
|
"claude-2.1",
|
||||||
"claude-3-sonnet-20240229",
|
"claude-3-sonnet-20240229",
|
||||||
"claude-3-opus-20240229",
|
"claude-3-opus-20240229",
|
||||||
"claude-3-opus-latest",
|
|
||||||
"claude-3-haiku-20240307",
|
"claude-3-haiku-20240307",
|
||||||
"claude-3-5-sonnet-20240620",
|
"claude-3-5-sonnet-20240620",
|
||||||
"claude-3-5-sonnet-20241022",
|
|
||||||
"claude-3-5-sonnet-latest",
|
|
||||||
"claude-3-5-haiku-latest",
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const baiduModels = [
|
const baiduModels = [
|
||||||
@@ -388,19 +364,6 @@ const iflytekModels = [
|
|||||||
"4.0Ultra",
|
"4.0Ultra",
|
||||||
];
|
];
|
||||||
|
|
||||||
const xAIModes = ["grok-beta"];
|
|
||||||
|
|
||||||
const chatglmModels = [
|
|
||||||
"glm-4-plus",
|
|
||||||
"glm-4-0520",
|
|
||||||
"glm-4",
|
|
||||||
"glm-4-air",
|
|
||||||
"glm-4-airx",
|
|
||||||
"glm-4-long",
|
|
||||||
"glm-4-flashx",
|
|
||||||
"glm-4-flash",
|
|
||||||
];
|
|
||||||
|
|
||||||
let seq = 1000; // 内置的模型序号生成器从1000开始
|
let seq = 1000; // 内置的模型序号生成器从1000开始
|
||||||
export const DEFAULT_MODELS = [
|
export const DEFAULT_MODELS = [
|
||||||
...openaiModels.map((name) => ({
|
...openaiModels.map((name) => ({
|
||||||
@@ -513,28 +476,6 @@ export const DEFAULT_MODELS = [
|
|||||||
sorted: 10,
|
sorted: 10,
|
||||||
},
|
},
|
||||||
})),
|
})),
|
||||||
...xAIModes.map((name) => ({
|
|
||||||
name,
|
|
||||||
available: true,
|
|
||||||
sorted: seq++,
|
|
||||||
provider: {
|
|
||||||
id: "xai",
|
|
||||||
providerName: "XAI",
|
|
||||||
providerType: "xai",
|
|
||||||
sorted: 11,
|
|
||||||
},
|
|
||||||
})),
|
|
||||||
...chatglmModels.map((name) => ({
|
|
||||||
name,
|
|
||||||
available: true,
|
|
||||||
sorted: seq++,
|
|
||||||
provider: {
|
|
||||||
id: "chatglm",
|
|
||||||
providerName: "ChatGLM",
|
|
||||||
providerType: "chatglm",
|
|
||||||
sorted: 12,
|
|
||||||
},
|
|
||||||
})),
|
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export const CHAT_PAGE_SIZE = 15;
|
export const CHAT_PAGE_SIZE = 15;
|
||||||
|
@@ -462,28 +462,6 @@ const cn = {
|
|||||||
SubTitle: "样例:",
|
SubTitle: "样例:",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
XAI: {
|
|
||||||
ApiKey: {
|
|
||||||
Title: "接口密钥",
|
|
||||||
SubTitle: "使用自定义XAI API Key",
|
|
||||||
Placeholder: "XAI API Key",
|
|
||||||
},
|
|
||||||
Endpoint: {
|
|
||||||
Title: "接口地址",
|
|
||||||
SubTitle: "样例:",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
ChatGLM: {
|
|
||||||
ApiKey: {
|
|
||||||
Title: "接口密钥",
|
|
||||||
SubTitle: "使用自定义 ChatGLM API Key",
|
|
||||||
Placeholder: "ChatGLM API Key",
|
|
||||||
},
|
|
||||||
Endpoint: {
|
|
||||||
Title: "接口地址",
|
|
||||||
SubTitle: "样例:",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Stability: {
|
Stability: {
|
||||||
ApiKey: {
|
ApiKey: {
|
||||||
Title: "接口密钥",
|
Title: "接口密钥",
|
||||||
|
@@ -446,28 +446,6 @@ const en: LocaleType = {
|
|||||||
SubTitle: "Example: ",
|
SubTitle: "Example: ",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
XAI: {
|
|
||||||
ApiKey: {
|
|
||||||
Title: "XAI API Key",
|
|
||||||
SubTitle: "Use a custom XAI API Key",
|
|
||||||
Placeholder: "XAI API Key",
|
|
||||||
},
|
|
||||||
Endpoint: {
|
|
||||||
Title: "Endpoint Address",
|
|
||||||
SubTitle: "Example: ",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
ChatGLM: {
|
|
||||||
ApiKey: {
|
|
||||||
Title: "ChatGLM API Key",
|
|
||||||
SubTitle: "Use a custom ChatGLM API Key",
|
|
||||||
Placeholder: "ChatGLM API Key",
|
|
||||||
},
|
|
||||||
Endpoint: {
|
|
||||||
Title: "Endpoint Address",
|
|
||||||
SubTitle: "Example: ",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Stability: {
|
Stability: {
|
||||||
ApiKey: {
|
ApiKey: {
|
||||||
Title: "Stability API Key",
|
Title: "Stability API Key",
|
||||||
|
@@ -13,8 +13,6 @@ import {
|
|||||||
MOONSHOT_BASE_URL,
|
MOONSHOT_BASE_URL,
|
||||||
STABILITY_BASE_URL,
|
STABILITY_BASE_URL,
|
||||||
IFLYTEK_BASE_URL,
|
IFLYTEK_BASE_URL,
|
||||||
XAI_BASE_URL,
|
|
||||||
CHATGLM_BASE_URL,
|
|
||||||
} from "../constant";
|
} from "../constant";
|
||||||
import { getHeaders } from "../client/api";
|
import { getHeaders } from "../client/api";
|
||||||
import { getClientConfig } from "../config/client";
|
import { getClientConfig } from "../config/client";
|
||||||
@@ -46,10 +44,6 @@ const DEFAULT_STABILITY_URL = isApp ? STABILITY_BASE_URL : ApiPath.Stability;
|
|||||||
|
|
||||||
const DEFAULT_IFLYTEK_URL = isApp ? IFLYTEK_BASE_URL : ApiPath.Iflytek;
|
const DEFAULT_IFLYTEK_URL = isApp ? IFLYTEK_BASE_URL : ApiPath.Iflytek;
|
||||||
|
|
||||||
const DEFAULT_XAI_URL = isApp ? XAI_BASE_URL : ApiPath.XAI;
|
|
||||||
|
|
||||||
const DEFAULT_CHATGLM_URL = isApp ? CHATGLM_BASE_URL : ApiPath.ChatGLM;
|
|
||||||
|
|
||||||
const DEFAULT_ACCESS_STATE = {
|
const DEFAULT_ACCESS_STATE = {
|
||||||
accessCode: "",
|
accessCode: "",
|
||||||
useCustomConfig: false,
|
useCustomConfig: false,
|
||||||
@@ -107,14 +101,6 @@ const DEFAULT_ACCESS_STATE = {
|
|||||||
iflytekApiKey: "",
|
iflytekApiKey: "",
|
||||||
iflytekApiSecret: "",
|
iflytekApiSecret: "",
|
||||||
|
|
||||||
// xai
|
|
||||||
xaiUrl: DEFAULT_XAI_URL,
|
|
||||||
xaiApiKey: "",
|
|
||||||
|
|
||||||
// chatglm
|
|
||||||
chatglmUrl: DEFAULT_CHATGLM_URL,
|
|
||||||
chatglmApiKey: "",
|
|
||||||
|
|
||||||
// server config
|
// server config
|
||||||
needCode: true,
|
needCode: true,
|
||||||
hideUserApiKey: false,
|
hideUserApiKey: false,
|
||||||
@@ -183,14 +169,6 @@ export const useAccessStore = createPersistStore(
|
|||||||
return ensure(get(), ["iflytekApiKey"]);
|
return ensure(get(), ["iflytekApiKey"]);
|
||||||
},
|
},
|
||||||
|
|
||||||
isValidXAI() {
|
|
||||||
return ensure(get(), ["xaiApiKey"]);
|
|
||||||
},
|
|
||||||
|
|
||||||
isValidChatGLM() {
|
|
||||||
return ensure(get(), ["chatglmApiKey"]);
|
|
||||||
},
|
|
||||||
|
|
||||||
isAuthorized() {
|
isAuthorized() {
|
||||||
this.fetch();
|
this.fetch();
|
||||||
|
|
||||||
@@ -206,8 +184,6 @@ export const useAccessStore = createPersistStore(
|
|||||||
this.isValidTencent() ||
|
this.isValidTencent() ||
|
||||||
this.isValidMoonshot() ||
|
this.isValidMoonshot() ||
|
||||||
this.isValidIflytek() ||
|
this.isValidIflytek() ||
|
||||||
this.isValidXAI() ||
|
|
||||||
this.isValidChatGLM() ||
|
|
||||||
!this.enabledAccessControl() ||
|
!this.enabledAccessControl() ||
|
||||||
(this.enabledAccessControl() && ensure(get(), ["accessCode"]))
|
(this.enabledAccessControl() && ensure(get(), ["accessCode"]))
|
||||||
);
|
);
|
||||||
|
@@ -352,13 +352,13 @@ export const useChatStore = createPersistStore(
|
|||||||
return session;
|
return session;
|
||||||
},
|
},
|
||||||
|
|
||||||
onNewMessage(message: ChatMessage, targetSession: ChatSession) {
|
onNewMessage(message: ChatMessage) {
|
||||||
get().updateTargetSession(targetSession, (session) => {
|
get().updateCurrentSession((session) => {
|
||||||
session.messages = session.messages.concat();
|
session.messages = session.messages.concat();
|
||||||
session.lastUpdate = Date.now();
|
session.lastUpdate = Date.now();
|
||||||
});
|
});
|
||||||
get().updateStat(message);
|
get().updateStat(message);
|
||||||
get().summarizeSession(false, targetSession);
|
get().summarizeSession();
|
||||||
},
|
},
|
||||||
|
|
||||||
async onUserInput(content: string, attachImages?: string[]) {
|
async onUserInput(content: string, attachImages?: string[]) {
|
||||||
@@ -428,7 +428,7 @@ export const useChatStore = createPersistStore(
|
|||||||
botMessage.streaming = false;
|
botMessage.streaming = false;
|
||||||
if (message) {
|
if (message) {
|
||||||
botMessage.content = message;
|
botMessage.content = message;
|
||||||
get().onNewMessage(botMessage, session);
|
get().onNewMessage(botMessage);
|
||||||
}
|
}
|
||||||
ChatControllerPool.remove(session.id, botMessage.id);
|
ChatControllerPool.remove(session.id, botMessage.id);
|
||||||
},
|
},
|
||||||
@@ -598,12 +598,9 @@ export const useChatStore = createPersistStore(
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
summarizeSession(
|
summarizeSession(refreshTitle: boolean = false) {
|
||||||
refreshTitle: boolean = false,
|
|
||||||
targetSession: ChatSession,
|
|
||||||
) {
|
|
||||||
const config = useAppConfig.getState();
|
const config = useAppConfig.getState();
|
||||||
const session = targetSession;
|
const session = get().currentSession();
|
||||||
const modelConfig = session.mask.modelConfig;
|
const modelConfig = session.mask.modelConfig;
|
||||||
// skip summarize when using dalle3?
|
// skip summarize when using dalle3?
|
||||||
if (isDalle3(modelConfig.model)) {
|
if (isDalle3(modelConfig.model)) {
|
||||||
@@ -652,15 +649,13 @@ export const useChatStore = createPersistStore(
|
|||||||
stream: false,
|
stream: false,
|
||||||
providerName,
|
providerName,
|
||||||
},
|
},
|
||||||
onFinish(message, responseRes) {
|
onFinish(message) {
|
||||||
if (responseRes?.status === 200) {
|
if (!isValidMessage(message)) return;
|
||||||
get().updateTargetSession(
|
get().updateCurrentSession(
|
||||||
session,
|
(session) =>
|
||||||
(session) =>
|
(session.topic =
|
||||||
(session.topic =
|
message.length > 0 ? trimTopic(message) : DEFAULT_TOPIC),
|
||||||
message.length > 0 ? trimTopic(message) : DEFAULT_TOPIC),
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -674,7 +669,7 @@ export const useChatStore = createPersistStore(
|
|||||||
|
|
||||||
const historyMsgLength = countMessages(toBeSummarizedMsgs);
|
const historyMsgLength = countMessages(toBeSummarizedMsgs);
|
||||||
|
|
||||||
if (historyMsgLength > (modelConfig?.max_tokens || 4000)) {
|
if (historyMsgLength > modelConfig?.max_tokens ?? 4000) {
|
||||||
const n = toBeSummarizedMsgs.length;
|
const n = toBeSummarizedMsgs.length;
|
||||||
toBeSummarizedMsgs = toBeSummarizedMsgs.slice(
|
toBeSummarizedMsgs = toBeSummarizedMsgs.slice(
|
||||||
Math.max(0, n - modelConfig.historyMessageCount),
|
Math.max(0, n - modelConfig.historyMessageCount),
|
||||||
@@ -720,20 +715,22 @@ export const useChatStore = createPersistStore(
|
|||||||
onUpdate(message) {
|
onUpdate(message) {
|
||||||
session.memoryPrompt = message;
|
session.memoryPrompt = message;
|
||||||
},
|
},
|
||||||
onFinish(message, responseRes) {
|
onFinish(message) {
|
||||||
if (responseRes?.status === 200) {
|
console.log("[Memory] ", message);
|
||||||
console.log("[Memory] ", message);
|
get().updateCurrentSession((session) => {
|
||||||
get().updateTargetSession(session, (session) => {
|
session.lastSummarizeIndex = lastSummarizeIndex;
|
||||||
session.lastSummarizeIndex = lastSummarizeIndex;
|
session.memoryPrompt = message; // Update the memory prompt for stored it in local storage
|
||||||
session.memoryPrompt = message; // Update the memory prompt for stored it in local storage
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onError(err) {
|
onError(err) {
|
||||||
console.error("[Summarize] ", err);
|
console.error("[Summarize] ", err);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isValidMessage(message: any): boolean {
|
||||||
|
return typeof message === "string" && !message.startsWith("```json");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
updateStat(message: ChatMessage) {
|
updateStat(message: ChatMessage) {
|
||||||
@@ -749,16 +746,7 @@ export const useChatStore = createPersistStore(
|
|||||||
updater(sessions[index]);
|
updater(sessions[index]);
|
||||||
set(() => ({ sessions }));
|
set(() => ({ sessions }));
|
||||||
},
|
},
|
||||||
updateTargetSession(
|
|
||||||
targetSession: ChatSession,
|
|
||||||
updater: (session: ChatSession) => void,
|
|
||||||
) {
|
|
||||||
const sessions = get().sessions;
|
|
||||||
const index = sessions.findIndex((s) => s.id === targetSession.id);
|
|
||||||
if (index < 0) return;
|
|
||||||
updater(sessions[index]);
|
|
||||||
set(() => ({ sessions }));
|
|
||||||
},
|
|
||||||
async clearAllData() {
|
async clearAllData() {
|
||||||
await indexedDBStorage.clear();
|
await indexedDBStorage.clear();
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
|
@@ -266,9 +266,7 @@ export function isVisionModel(model: string) {
|
|||||||
model.includes("gpt-4-turbo") && !model.includes("preview");
|
model.includes("gpt-4-turbo") && !model.includes("preview");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
visionKeywords.some((keyword) => model.includes(keyword)) ||
|
visionKeywords.some((keyword) => model.includes(keyword)) || isGpt4Turbo
|
||||||
isGpt4Turbo ||
|
|
||||||
isDalle3(model)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,8 +278,7 @@ export function showPlugins(provider: ServiceProvider, model: string) {
|
|||||||
if (
|
if (
|
||||||
provider == ServiceProvider.OpenAI ||
|
provider == ServiceProvider.OpenAI ||
|
||||||
provider == ServiceProvider.Azure ||
|
provider == ServiceProvider.Azure ||
|
||||||
provider == ServiceProvider.Moonshot ||
|
provider == ServiceProvider.Moonshot
|
||||||
provider == ServiceProvider.ChatGLM
|
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -174,7 +174,6 @@ export function stream(
|
|||||||
let finished = false;
|
let finished = false;
|
||||||
let running = false;
|
let running = false;
|
||||||
let runTools: any[] = [];
|
let runTools: any[] = [];
|
||||||
let responseRes: Response;
|
|
||||||
|
|
||||||
// animate response to make it looks smooth
|
// animate response to make it looks smooth
|
||||||
function animateResponseText() {
|
function animateResponseText() {
|
||||||
@@ -273,7 +272,7 @@ export function stream(
|
|||||||
}
|
}
|
||||||
console.debug("[ChatAPI] end");
|
console.debug("[ChatAPI] end");
|
||||||
finished = true;
|
finished = true;
|
||||||
options.onFinish(responseText + remainText, responseRes); // 将res传递给onFinish
|
options.onFinish(responseText + remainText);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -305,7 +304,6 @@ export function stream(
|
|||||||
clearTimeout(requestTimeoutId);
|
clearTimeout(requestTimeoutId);
|
||||||
const contentType = res.headers.get("content-type");
|
const contentType = res.headers.get("content-type");
|
||||||
console.log("[Request] response content type: ", contentType);
|
console.log("[Request] response content type: ", contentType);
|
||||||
responseRes = res;
|
|
||||||
|
|
||||||
if (contentType?.startsWith("text/plain")) {
|
if (contentType?.startsWith("text/plain")) {
|
||||||
responseText = await res.clone().text();
|
responseText = await res.clone().text();
|
||||||
|
@@ -19,7 +19,7 @@ type StreamResponse = {
|
|||||||
headers: Record<string, string>;
|
headers: Record<string, string>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function fetch(url: string, options?: RequestInit): Promise<Response> {
|
export function fetch(url: string, options?: RequestInit): Promise<any> {
|
||||||
if (window.__TAURI__) {
|
if (window.__TAURI__) {
|
||||||
const {
|
const {
|
||||||
signal,
|
signal,
|
||||||
@@ -100,8 +100,7 @@ export function fetch(url: string, options?: RequestInit): Promise<Response> {
|
|||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.error("stream error", e);
|
console.error("stream error", e);
|
||||||
// throw e;
|
throw e;
|
||||||
return new Response("", { status: 599 });
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return window.fetch(url, options);
|
return window.fetch(url, options);
|
||||||
|
@@ -1,29 +0,0 @@
|
|||||||
# 宝塔面板 的部署说明
|
|
||||||
|
|
||||||
## 拥有自己的宝塔
|
|
||||||
当你需要通过 宝塔面板 部署本项目之前,需要在服务器上先安装好 宝塔面板工具。 接下来的 部署流程 都建立在已有宝塔面板的前提下。宝塔安装请参考 ([宝塔官网](https://www.bt.cn/new/download.html))
|
|
||||||
|
|
||||||
> 注意:本项目需要宝塔面板版本 9.2.0 及以上
|
|
||||||
|
|
||||||
## 一键安装
|
|
||||||

|
|
||||||
1. 在 宝塔面板 -> Docker -> 应用商店 页面,搜索 ChatGPT-Next-Web 找到本项目的docker应用;
|
|
||||||
2. 点击 安装 开始部署本项目
|
|
||||||
|
|
||||||

|
|
||||||
1. 在项目配置页,根据要求开始配置环境变量;
|
|
||||||
2. 如勾选 允许外部访问 配置,请注意为配置的 web端口 开放安全组端口访问权限;
|
|
||||||
3. 请确保你添加了正确的 Open Api Key,否则无法使用;当配置 OpenAI官方 提供的key(国内无法访问),请配置代理地址;
|
|
||||||
4. 建议配置 访问权限密码,否则部署后所有人均可使用已配置的 Open Api Key(当允许外部访问时);
|
|
||||||
5. 点击 确认 开始自动部署。
|
|
||||||
|
|
||||||
## 如何访问
|
|
||||||

|
|
||||||
通过根据 服务器IP地址 和配置的 web端口 http://$(host):$(port),在浏览器中打开 ChatGPT-Next-Web。
|
|
||||||
|
|
||||||

|
|
||||||
若配置了 访问权限密码,访问大模型前需要登录,请点击 登录,获取访问权限。
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
Binary file not shown.
Before Width: | Height: | Size: 161 KiB |
Binary file not shown.
Before Width: | Height: | Size: 196 KiB |
Binary file not shown.
Before Width: | Height: | Size: 117 KiB |
Binary file not shown.
Before Width: | Height: | Size: 159 KiB |
Binary file not shown.
Before Width: | Height: | Size: 74 KiB |
Binary file not shown.
Before Width: | Height: | Size: 146 KiB |
@@ -1,24 +1,2 @@
|
|||||||
// Learn more: https://github.com/testing-library/jest-dom
|
// Learn more: https://github.com/testing-library/jest-dom
|
||||||
import "@testing-library/jest-dom";
|
import "@testing-library/jest-dom";
|
||||||
|
|
||||||
global.fetch = jest.fn(() =>
|
|
||||||
Promise.resolve({
|
|
||||||
ok: true,
|
|
||||||
status: 200,
|
|
||||||
json: () => Promise.resolve({}),
|
|
||||||
headers: new Headers(),
|
|
||||||
redirected: false,
|
|
||||||
statusText: "OK",
|
|
||||||
type: "basic",
|
|
||||||
url: "",
|
|
||||||
clone: function () {
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
body: null,
|
|
||||||
bodyUsed: false,
|
|
||||||
arrayBuffer: () => Promise.resolve(new ArrayBuffer(0)),
|
|
||||||
blob: () => Promise.resolve(new Blob()),
|
|
||||||
formData: () => Promise.resolve(new FormData()),
|
|
||||||
text: () => Promise.resolve(""),
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
@@ -94,12 +94,8 @@ if (mode !== "export") {
|
|||||||
source: "/sharegpt",
|
source: "/sharegpt",
|
||||||
destination: "https://sharegpt.com/api/conversations",
|
destination: "https://sharegpt.com/api/conversations",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
source: "/api/proxy/alibaba/:path*",
|
|
||||||
destination: "https://dashscope.aliyuncs.com/api/:path*",
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
beforeFiles: ret,
|
beforeFiles: ret,
|
||||||
};
|
};
|
||||||
|
@@ -33,8 +33,8 @@
|
|||||||
"html-to-image": "^1.11.11",
|
"html-to-image": "^1.11.11",
|
||||||
"idb-keyval": "^6.2.1",
|
"idb-keyval": "^6.2.1",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"markdown-to-txt": "^2.0.1",
|
|
||||||
"mermaid": "^10.6.1",
|
"mermaid": "^10.6.1",
|
||||||
|
"markdown-to-txt": "^2.0.1",
|
||||||
"nanoid": "^5.0.3",
|
"nanoid": "^5.0.3",
|
||||||
"next": "^14.1.1",
|
"next": "^14.1.1",
|
||||||
"node-fetch": "^3.3.1",
|
"node-fetch": "^3.3.1",
|
||||||
@@ -56,10 +56,9 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tauri-apps/api": "^1.6.0",
|
"@tauri-apps/api": "^1.6.0",
|
||||||
"@tauri-apps/cli": "1.5.11",
|
"@tauri-apps/cli": "1.5.11",
|
||||||
"@testing-library/dom": "^10.4.0",
|
"@testing-library/jest-dom": "^6.4.8",
|
||||||
"@testing-library/jest-dom": "^6.6.2",
|
"@testing-library/react": "^16.0.0",
|
||||||
"@testing-library/react": "^16.0.1",
|
"@types/jest": "^29.5.13",
|
||||||
"@types/jest": "^29.5.14",
|
|
||||||
"@types/js-yaml": "4.0.9",
|
"@types/js-yaml": "4.0.9",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/node": "^20.11.30",
|
"@types/node": "^20.11.30",
|
||||||
|
@@ -119,22 +119,11 @@ pub async fn stream_fetch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
let error: String = err.source()
|
println!("Error response: {:?}", err.source().expect("REASON").to_string());
|
||||||
.map(|e| e.to_string())
|
|
||||||
.unwrap_or_else(|| "Unknown error occurred".to_string());
|
|
||||||
println!("Error response: {:?}", error);
|
|
||||||
tauri::async_runtime::spawn( async move {
|
|
||||||
if let Err(e) = window.emit(event_name, ChunkPayload{ request_id, chunk: error.into() }) {
|
|
||||||
println!("Failed to emit chunk payload: {:?}", e);
|
|
||||||
}
|
|
||||||
if let Err(e) = window.emit(event_name, EndPayload{ request_id, status: 0 }) {
|
|
||||||
println!("Failed to emit end payload: {:?}", e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
StreamResponse {
|
StreamResponse {
|
||||||
request_id,
|
request_id,
|
||||||
status: 599,
|
status: 599,
|
||||||
status_text: "Error".to_string(),
|
status_text: err.source().expect("REASON").to_string(),
|
||||||
headers: HashMap::new(),
|
headers: HashMap::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
},
|
},
|
||||||
"package": {
|
"package": {
|
||||||
"productName": "NextChat",
|
"productName": "NextChat",
|
||||||
"version": "2.15.7"
|
"version": "2.15.5"
|
||||||
},
|
},
|
||||||
"tauri": {
|
"tauri": {
|
||||||
"allowlist": {
|
"allowlist": {
|
||||||
|
102
yarn.lock
102
yarn.lock
@@ -27,15 +27,6 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@babel/highlight" "^7.18.6"
|
"@babel/highlight" "^7.18.6"
|
||||||
|
|
||||||
"@babel/code-frame@^7.10.4":
|
|
||||||
version "7.26.0"
|
|
||||||
resolved "https://registry.npmmirror.com/@babel/code-frame/-/code-frame-7.26.0.tgz#9374b5cd068d128dac0b94ff482594273b1c2815"
|
|
||||||
integrity sha512-INCKxTtbXtcNbUZ3YXutwMpEleqttcswhAdee7dhuoVrD2cnuc3PqtERBtxkX5nziX9vnBL8WXmSGwv8CuPV6g==
|
|
||||||
dependencies:
|
|
||||||
"@babel/helper-validator-identifier" "^7.25.9"
|
|
||||||
js-tokens "^4.0.0"
|
|
||||||
picocolors "^1.0.0"
|
|
||||||
|
|
||||||
"@babel/code-frame@^7.12.13", "@babel/code-frame@^7.24.7":
|
"@babel/code-frame@^7.12.13", "@babel/code-frame@^7.24.7":
|
||||||
version "7.24.7"
|
version "7.24.7"
|
||||||
resolved "https://registry.npmmirror.com/@babel/code-frame/-/code-frame-7.24.7.tgz#882fd9e09e8ee324e496bd040401c6f046ef4465"
|
resolved "https://registry.npmmirror.com/@babel/code-frame/-/code-frame-7.24.7.tgz#882fd9e09e8ee324e496bd040401c6f046ef4465"
|
||||||
@@ -403,11 +394,6 @@
|
|||||||
resolved "https://registry.npmmirror.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz#75b889cfaf9e35c2aaf42cf0d72c8e91719251db"
|
resolved "https://registry.npmmirror.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz#75b889cfaf9e35c2aaf42cf0d72c8e91719251db"
|
||||||
integrity sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==
|
integrity sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==
|
||||||
|
|
||||||
"@babel/helper-validator-identifier@^7.25.9":
|
|
||||||
version "7.25.9"
|
|
||||||
resolved "https://registry.npmmirror.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7"
|
|
||||||
integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==
|
|
||||||
|
|
||||||
"@babel/helper-validator-option@^7.18.6", "@babel/helper-validator-option@^7.21.0":
|
"@babel/helper-validator-option@^7.18.6", "@babel/helper-validator-option@^7.21.0":
|
||||||
version "7.21.0"
|
version "7.21.0"
|
||||||
resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz#8224c7e13ace4bafdc4004da2cf064ef42673180"
|
resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz#8224c7e13ace4bafdc4004da2cf064ef42673180"
|
||||||
@@ -1201,7 +1187,14 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310"
|
resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310"
|
||||||
integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==
|
integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==
|
||||||
|
|
||||||
"@babel/runtime@^7.12.1", "@babel/runtime@^7.12.5", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.0", "@babel/runtime@^7.23.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2":
|
"@babel/runtime@^7.12.1", "@babel/runtime@^7.20.7", "@babel/runtime@^7.23.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2":
|
||||||
|
version "7.23.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.6.tgz#c05e610dc228855dc92ef1b53d07389ed8ab521d"
|
||||||
|
integrity sha512-zHd0eUrf5GZoOWVCXp6koAKQTfZV07eit6bGPmJgnZdnSAvvZee6zniW2XMF7Cmc4ISOOnPy3QaSiIJGJkVEDQ==
|
||||||
|
dependencies:
|
||||||
|
regenerator-runtime "^0.14.0"
|
||||||
|
|
||||||
|
"@babel/runtime@^7.12.5", "@babel/runtime@^7.21.0":
|
||||||
version "7.25.0"
|
version "7.25.0"
|
||||||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.25.0.tgz#3af9a91c1b739c569d5d80cc917280919c544ecb"
|
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.25.0.tgz#3af9a91c1b739c569d5d80cc917280919c544ecb"
|
||||||
integrity sha512-7dRy4DwXwtzBrPbZflqxnvfxLF8kdZXPkhymtDeFoFqE6ldzjQFgYTtYIFARcLEYDrqfBfYcZt1WqFxRoyC9Rw==
|
integrity sha512-7dRy4DwXwtzBrPbZflqxnvfxLF8kdZXPkhymtDeFoFqE6ldzjQFgYTtYIFARcLEYDrqfBfYcZt1WqFxRoyC9Rw==
|
||||||
@@ -2100,26 +2093,13 @@
|
|||||||
"@tauri-apps/cli-win32-ia32-msvc" "1.5.11"
|
"@tauri-apps/cli-win32-ia32-msvc" "1.5.11"
|
||||||
"@tauri-apps/cli-win32-x64-msvc" "1.5.11"
|
"@tauri-apps/cli-win32-x64-msvc" "1.5.11"
|
||||||
|
|
||||||
"@testing-library/dom@^10.4.0":
|
"@testing-library/jest-dom@^6.4.8":
|
||||||
version "10.4.0"
|
version "6.4.8"
|
||||||
resolved "https://registry.npmmirror.com/@testing-library/dom/-/dom-10.4.0.tgz#82a9d9462f11d240ecadbf406607c6ceeeff43a8"
|
resolved "https://registry.npmmirror.com/@testing-library/jest-dom/-/jest-dom-6.4.8.tgz#9c435742b20c6183d4e7034f2b329d562c079daa"
|
||||||
integrity sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==
|
integrity sha512-JD0G+Zc38f5MBHA4NgxQMR5XtO5Jx9g86jqturNTt2WUfRmLDIY7iKkWHDCCTiDuFMre6nxAD5wHw9W5kI4rGw==
|
||||||
dependencies:
|
|
||||||
"@babel/code-frame" "^7.10.4"
|
|
||||||
"@babel/runtime" "^7.12.5"
|
|
||||||
"@types/aria-query" "^5.0.1"
|
|
||||||
aria-query "5.3.0"
|
|
||||||
chalk "^4.1.0"
|
|
||||||
dom-accessibility-api "^0.5.9"
|
|
||||||
lz-string "^1.5.0"
|
|
||||||
pretty-format "^27.0.2"
|
|
||||||
|
|
||||||
"@testing-library/jest-dom@^6.6.2":
|
|
||||||
version "6.6.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-6.6.2.tgz#8186aa9a07263adef9cc5a59a4772db8c31f4a5b"
|
|
||||||
integrity sha512-P6GJD4yqc9jZLbe98j/EkyQDTPgqftohZF5FBkHY5BUERZmcf4HeO2k0XaefEg329ux2p21i1A1DmyQ1kKw2Jw==
|
|
||||||
dependencies:
|
dependencies:
|
||||||
"@adobe/css-tools" "^4.4.0"
|
"@adobe/css-tools" "^4.4.0"
|
||||||
|
"@babel/runtime" "^7.9.2"
|
||||||
aria-query "^5.0.0"
|
aria-query "^5.0.0"
|
||||||
chalk "^3.0.0"
|
chalk "^3.0.0"
|
||||||
css.escape "^1.5.1"
|
css.escape "^1.5.1"
|
||||||
@@ -2127,10 +2107,10 @@
|
|||||||
lodash "^4.17.21"
|
lodash "^4.17.21"
|
||||||
redent "^3.0.0"
|
redent "^3.0.0"
|
||||||
|
|
||||||
"@testing-library/react@^16.0.1":
|
"@testing-library/react@^16.0.0":
|
||||||
version "16.0.1"
|
version "16.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-16.0.1.tgz#29c0ee878d672703f5e7579f239005e4e0faa875"
|
resolved "https://registry.npmmirror.com/@testing-library/react/-/react-16.0.0.tgz#0a1e0c7a3de25841c3591b8cb7fb0cf0c0a27321"
|
||||||
integrity sha512-dSmwJVtJXmku+iocRhWOUFbrERC76TX2Mnf0ATODz8brzAZrMBbzLwQixlBSanZxR6LddK3eiwpSFZgDET1URg==
|
integrity sha512-guuxUKRWQ+FgNX0h0NS0FIq3Q3uLtWVpBzcLOggmfMoUpgBnzBzvLLd4fbm6yS8ydJd94cIfY4yP9qUQjM2KwQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.12.5"
|
"@babel/runtime" "^7.12.5"
|
||||||
|
|
||||||
@@ -2164,11 +2144,6 @@
|
|||||||
resolved "https://registry.npmmirror.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9"
|
resolved "https://registry.npmmirror.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9"
|
||||||
integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==
|
integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==
|
||||||
|
|
||||||
"@types/aria-query@^5.0.1":
|
|
||||||
version "5.0.4"
|
|
||||||
resolved "https://registry.npmmirror.com/@types/aria-query/-/aria-query-5.0.4.tgz#1a31c3d378850d2778dabb6374d036dcba4ba708"
|
|
||||||
integrity sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==
|
|
||||||
|
|
||||||
"@types/babel__core@^7.1.14":
|
"@types/babel__core@^7.1.14":
|
||||||
version "7.20.5"
|
version "7.20.5"
|
||||||
resolved "https://registry.npmmirror.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017"
|
resolved "https://registry.npmmirror.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017"
|
||||||
@@ -2288,10 +2263,10 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@types/istanbul-lib-report" "*"
|
"@types/istanbul-lib-report" "*"
|
||||||
|
|
||||||
"@types/jest@^29.5.14":
|
"@types/jest@^29.5.13":
|
||||||
version "29.5.14"
|
version "29.5.13"
|
||||||
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.14.tgz#2b910912fa1d6856cadcd0c1f95af7df1d6049e5"
|
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.13.tgz#8bc571659f401e6a719a7bf0dbcb8b78c71a8adc"
|
||||||
integrity sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ==
|
integrity sha512-wd+MVEZCHt23V0/L642O5APvspWply/rGY5BcW4SUETo2UzPU3Z26qr8jC2qxpimI2jjx9h7+2cj2FwIr01bXg==
|
||||||
dependencies:
|
dependencies:
|
||||||
expect "^29.0.0"
|
expect "^29.0.0"
|
||||||
pretty-format "^29.0.0"
|
pretty-format "^29.0.0"
|
||||||
@@ -2763,13 +2738,20 @@ argparse@^2.0.1:
|
|||||||
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
|
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
|
||||||
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
|
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
|
||||||
|
|
||||||
aria-query@5.3.0, aria-query@^5.0.0, aria-query@^5.1.3:
|
aria-query@^5.0.0:
|
||||||
version "5.3.0"
|
version "5.3.0"
|
||||||
resolved "https://registry.npmmirror.com/aria-query/-/aria-query-5.3.0.tgz#650c569e41ad90b51b3d7df5e5eed1c7549c103e"
|
resolved "https://registry.npmmirror.com/aria-query/-/aria-query-5.3.0.tgz#650c569e41ad90b51b3d7df5e5eed1c7549c103e"
|
||||||
integrity sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==
|
integrity sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==
|
||||||
dependencies:
|
dependencies:
|
||||||
dequal "^2.0.3"
|
dequal "^2.0.3"
|
||||||
|
|
||||||
|
aria-query@^5.1.3:
|
||||||
|
version "5.1.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.1.3.tgz#19db27cd101152773631396f7a95a3b58c22c35e"
|
||||||
|
integrity sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==
|
||||||
|
dependencies:
|
||||||
|
deep-equal "^2.0.5"
|
||||||
|
|
||||||
array-buffer-byte-length@^1.0.0:
|
array-buffer-byte-length@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz#fabe8bc193fea865f317fe7807085ee0dee5aead"
|
resolved "https://registry.yarnpkg.com/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz#fabe8bc193fea865f317fe7807085ee0dee5aead"
|
||||||
@@ -3099,7 +3081,7 @@ chalk@^3.0.0:
|
|||||||
ansi-styles "^4.1.0"
|
ansi-styles "^4.1.0"
|
||||||
supports-color "^7.1.0"
|
supports-color "^7.1.0"
|
||||||
|
|
||||||
chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.2:
|
chalk@^4.0.0, chalk@^4.1.2:
|
||||||
version "4.1.2"
|
version "4.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
|
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
|
||||||
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
|
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
|
||||||
@@ -3895,11 +3877,6 @@ doctrine@^3.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
esutils "^2.0.2"
|
esutils "^2.0.2"
|
||||||
|
|
||||||
dom-accessibility-api@^0.5.9:
|
|
||||||
version "0.5.16"
|
|
||||||
resolved "https://registry.npmmirror.com/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz#5a7429e6066eb3664d911e33fb0e45de8eb08453"
|
|
||||||
integrity sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==
|
|
||||||
|
|
||||||
dom-accessibility-api@^0.6.3:
|
dom-accessibility-api@^0.6.3:
|
||||||
version "0.6.3"
|
version "0.6.3"
|
||||||
resolved "https://registry.npmmirror.com/dom-accessibility-api/-/dom-accessibility-api-0.6.3.tgz#993e925cc1d73f2c662e7d75dd5a5445259a8fd8"
|
resolved "https://registry.npmmirror.com/dom-accessibility-api/-/dom-accessibility-api-0.6.3.tgz#993e925cc1d73f2c662e7d75dd5a5445259a8fd8"
|
||||||
@@ -6075,11 +6052,6 @@ lru-cache@^6.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
yallist "^4.0.0"
|
yallist "^4.0.0"
|
||||||
|
|
||||||
lz-string@^1.5.0:
|
|
||||||
version "1.5.0"
|
|
||||||
resolved "https://registry.npmmirror.com/lz-string/-/lz-string-1.5.0.tgz#c1ab50f77887b712621201ba9fd4e3a6ed099941"
|
|
||||||
integrity sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==
|
|
||||||
|
|
||||||
make-dir@^4.0.0:
|
make-dir@^4.0.0:
|
||||||
version "4.0.0"
|
version "4.0.0"
|
||||||
resolved "https://registry.npmmirror.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e"
|
resolved "https://registry.npmmirror.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e"
|
||||||
@@ -7046,15 +7018,6 @@ prettier@^3.0.2:
|
|||||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.2.tgz#78fcecd6d870551aa5547437cdae39d4701dca5b"
|
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.2.tgz#78fcecd6d870551aa5547437cdae39d4701dca5b"
|
||||||
integrity sha512-o2YR9qtniXvwEZlOKbveKfDQVyqxbEIWn48Z8m3ZJjBjcCmUy3xZGIv+7AkaeuaTr6yPXJjwv07ZWlsWbEy1rQ==
|
integrity sha512-o2YR9qtniXvwEZlOKbveKfDQVyqxbEIWn48Z8m3ZJjBjcCmUy3xZGIv+7AkaeuaTr6yPXJjwv07ZWlsWbEy1rQ==
|
||||||
|
|
||||||
pretty-format@^27.0.2:
|
|
||||||
version "27.5.1"
|
|
||||||
resolved "https://registry.npmmirror.com/pretty-format/-/pretty-format-27.5.1.tgz#2181879fdea51a7a5851fb39d920faa63f01d88e"
|
|
||||||
integrity sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==
|
|
||||||
dependencies:
|
|
||||||
ansi-regex "^5.0.1"
|
|
||||||
ansi-styles "^5.0.0"
|
|
||||||
react-is "^17.0.1"
|
|
||||||
|
|
||||||
pretty-format@^29.0.0, pretty-format@^29.7.0:
|
pretty-format@^29.0.0, pretty-format@^29.7.0:
|
||||||
version "29.7.0"
|
version "29.7.0"
|
||||||
resolved "https://registry.npmmirror.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812"
|
resolved "https://registry.npmmirror.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812"
|
||||||
@@ -7146,11 +7109,6 @@ react-is@^16.13.1, react-is@^16.7.0:
|
|||||||
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
|
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
|
||||||
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
|
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
|
||||||
|
|
||||||
react-is@^17.0.1:
|
|
||||||
version "17.0.2"
|
|
||||||
resolved "https://registry.npmmirror.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
|
|
||||||
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==
|
|
||||||
|
|
||||||
react-is@^18.0.0:
|
react-is@^18.0.0:
|
||||||
version "18.2.0"
|
version "18.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b"
|
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b"
|
||||||
|
Reference in New Issue
Block a user