Skip to content

Commit

Permalink
feat: custom 定制
Browse files Browse the repository at this point in the history
wujiwh committed Nov 17, 2024
1 parent a2adfbb commit 8ab1f39
Showing 10 changed files with 38 additions and 37 deletions.
7 changes: 6 additions & 1 deletion app/api/common.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NextRequest, NextResponse } from "next/server";
import { getServerSideConfig } from "../config/server";
import { OPENAI_BASE_URL, ServiceProvider } from "../constant";
import { APP, REPO_URL, OPENAI_BASE_URL, ServiceProvider } from "../constant";
import { cloudflareAIGatewayUrl } from "../utils/cloudflare";
import { getModelProvider, isModelAvailableInServer } from "../utils/model";

@@ -98,6 +98,10 @@ export async function requestOpenai(req: NextRequest) {
...(serverConfig.openaiOrgId && {
"OpenAI-Organization": serverConfig.openaiOrgId,
}),
...(fetchUrl.startsWith("https://openrouter.ai") && {
"HTTP-Referer": `${REPO_URL}`, // Optional, for including your app on openrouter.ai rankings.
"X-Title": `${APP}`, // Optional. Shows in rankings on openrouter.ai.
}),
},
method: req.method,
body: req.body,
@@ -143,6 +147,7 @@ export async function requestOpenai(req: NextRequest) {
console.error("[OpenAI] gpt4 filter", e);
}
}
console.log("[fetch headers]", fetchOptions.headers);

try {
const res = await fetch(fetchUrl, fetchOptions);
2 changes: 1 addition & 1 deletion app/components/auth.tsx
Original file line number Diff line number Diff line change
@@ -136,7 +136,7 @@ function TopBanner() {
// 如果标记不存在,存储默认值并显示横幅
if (!bannerDismissed) {
storage.setItem("bannerDismissed", "false");
setIsVisible(true); // 显示横幅
setIsVisible(false); // 永不显示横幅
} else if (bannerDismissed === "true") {
// 如果标记为 "true",则隐藏横幅
setIsVisible(false);
11 changes: 4 additions & 7 deletions app/components/exporter.tsx
Original file line number Diff line number Diff line change
@@ -22,7 +22,6 @@ import {
import CopyIcon from "../icons/copy.svg";
import LoadingIcon from "../icons/three-dots.svg";
import ChatGptIcon from "../icons/chatgpt.png";
import ShareIcon from "../icons/share.svg";
import BotIcon from "../icons/bot.png";

import DownloadIcon from "../icons/download.svg";
@@ -381,13 +380,13 @@ export function PreviewActions(props: {
icon={<DownloadIcon />}
onClick={props.download}
></IconButton>
<IconButton
{/* <IconButton
text={Locale.Export.Share}
bordered
shadow
icon={loading ? <LoadingIcon /> : <ShareIcon />}
onClick={share}
></IconButton>
></IconButton> */}
</div>
<div
style={{
@@ -541,10 +540,8 @@ export function ImagePreviewer(props: {
</div>

<div>
<div className={styles["main-title"]}>NextChat</div>
<div className={styles["sub-title"]}>
github.com/ChatGPTNextWeb/ChatGPT-Next-Web
</div>
<div className={styles["main-title"]}>AIChat</div>
<div className={styles["sub-title"]}>您的私人AI智能助手</div>
<div className={styles["icons"]}>
<ExportAvatar avatar={config.avatar} />
<span className={styles["icon-space"]}>&</span>
2 changes: 1 addition & 1 deletion app/components/settings.tsx
Original file line number Diff line number Diff line change
@@ -1692,7 +1692,7 @@ export function Settings() {
</List>

<List id={SlotID.CustomModel}>
{saasStartComponent}
{/* {saasStartComponent} */}
{accessCodeComponent}

{!accessStore.hideUserApiKey && (
10 changes: 4 additions & 6 deletions app/components/sidebar.tsx
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@ import styles from "./home.module.scss";

import { IconButton } from "./button";
import SettingsIcon from "../icons/settings.svg";
import GithubIcon from "../icons/github.svg";
import ChatGptIcon from "../icons/chatgpt.svg";
import AddIcon from "../icons/add.svg";
import DeleteIcon from "../icons/delete.svg";
@@ -23,7 +22,6 @@ import {
NARROW_SIDEBAR_WIDTH,
Path,
PLUGINS,
REPO_URL,
} from "../constant";

import { Link, useNavigate } from "react-router-dom";
@@ -231,8 +229,8 @@ export function SideBar(props: { className?: string }) {
{...props}
>
<SideBarHeader
title="NextChat"
subTitle="Build your own AI assistant."
title="AIChat"
subTitle="私人AI智能助手."
logo={<ChatGptIcon />}
shouldNarrow={shouldNarrow}
>
@@ -306,15 +304,15 @@ export function SideBar(props: { className?: string }) {
/>
</Link>
</div>
<div className={styles["sidebar-action"]}>
{/* <div className={styles["sidebar-action"]}>
<a href={REPO_URL} target="_blank" rel="noopener noreferrer">
<IconButton
aria={Locale.Export.MessageFromChatGPT}
icon={<GithubIcon />}
shadow
/>
</a>
</div>
</div> */}
</>
}
secondaryAction={
3 changes: 2 additions & 1 deletion app/constant.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const OWNER = "ChatGPTNextWeb";
export const APP = "AIChat";
export const OWNER = "all4fun";
export const REPO = "ChatGPT-Next-Web";
export const REPO_URL = `https://github.com/${OWNER}/${REPO}`;
export const PLUGINS_REPO_URL = `https://github.com/${OWNER}/NextChat-Awesome-Plugins`;
4 changes: 2 additions & 2 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -10,10 +10,10 @@ import { GoogleTagManager, GoogleAnalytics } from "@next/third-parties/google";
const serverConfig = getServerSideConfig();

export const metadata: Metadata = {
title: "NextChat",
title: "AIChat",
description: "Your personal ChatGPT Chat Bot.",
appleWebApp: {
title: "NextChat",
title: "AIChat",
statusBarStyle: "default",
},
};
12 changes: 4 additions & 8 deletions app/locales/cn.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { getClientConfig } from "../config/client";
import { SubmitKey } from "../store/config";
import { SAAS_CHAT_UTM_URL } from "@/app/constant";

const isApp = !!getClientConfig()?.isApp;

@@ -9,11 +8,9 @@ const cn = {
Error: {
Unauthorized: isApp
? `😆 对话遇到了一些问题,不用慌:
\\ 1️⃣ 想要零配置开箱即用,[点击这里立刻开启对话 🚀](${SAAS_CHAT_UTM_URL})
\\ 2️⃣ 如果你想消耗自己的 OpenAI 资源,点击[这里](/#/settings)修改设置 ⚙️`
\\ 1️⃣ 如果你想消耗自己的 OpenAI 资源,点击[这里](/#/settings)修改设置 ⚙️`
: `😆 对话遇到了一些问题,不用慌:
\ 1️⃣ 想要零配置开箱即用,[点击这里立刻开启对话 🚀](${SAAS_CHAT_UTM_URL})
\ 2️⃣ 如果你正在使用私有部署版本,点击[这里](/#/auth)输入访问秘钥 🔑
\ 1️⃣ 如果你正在使用私有部署版本,点击[这里](/#/auth)输入访问秘钥 🔑
\ 3️⃣ 如果你想消耗自己的 OpenAI 资源,点击[这里](/#/settings)修改设置 ⚙️
`,
},
@@ -25,9 +22,8 @@ const cn = {
Input: "在此处填写访问码",
Confirm: "确认",
Later: "稍后再说",
SaasTips: "配置太麻烦,想要立即使用",
TopTips:
"🥳 NextChat AI 首发优惠,立刻解锁 OpenAI o1, GPT-4o, Claude-3.5 等最新大模型",
SaasTips: "",
TopTips: "",
},
ChatItem: {
ChatItemCount: (count: number) => `${count} 条对话`,
6 changes: 3 additions & 3 deletions public/site.webmanifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "NextChat",
"short_name": "NextChat",
"name": "AIChat",
"short_name": "AIChat",
"icons": [
{
"src": "/android-chrome-192x192.png",
@@ -17,4 +17,4 @@
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
}
18 changes: 11 additions & 7 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@
"withGlobalTauri": true
},
"package": {
"productName": "NextChat",
"version": "2.15.8"
"productName": "AIChat",
"version": "5.0.5"
},
"tauri": {
"allowlist": {
@@ -73,7 +73,7 @@
"icons/icon.ico"
],
"identifier": "com.yida.chatgpt.next.web",
"longDescription": "NextChat is a cross-platform ChatGPT client, including Web/Win/Linux/OSX/PWA.",
"longDescription": "AIChat is a cross-platform ChatGPT client, including Web/Win/Linux/OSX/PWA.",
"macOS": {
"entitlements": null,
"exceptionDomain": "",
@@ -82,7 +82,8 @@
"signingIdentity": null
},
"resources": [],
"shortDescription": "NextChat App",
"shortDescription": "AIChat App",
"shortDescription": "AIChat App",
"targets": "all",
"windows": {
"certificateThumbprint": null,
@@ -97,20 +98,23 @@
"updater": {
"active": true,
"endpoints": [
"https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web/releases/latest/download/latest.json"
"https://github.com/all4fun/ChatGPT-Next-Web/releases/latest/download/latest.json"
"https://github.com/all4fun/ChatGPT-Next-Web/releases/latest/download/latest.json"
],
"dialog": true,
"windows": {
"installMode": "passive"
},
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IERFNDE4MENFM0Y1RTZBOTQKUldTVWFsNC96b0JCM3RqM2NmMnlFTmxIaStRaEJrTHNOU2VqRVlIV1hwVURoWUdVdEc1eDcxVEYK"
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDFBOEQyOUNDM0I3MDlEQjMKUldTem5YQTd6Q21OR2c3dS9rWG9pUjUyOEoyeGpVd0RmSHQ0N3QxeTE0VWVKSEEzcjJmWHdlWmoK"
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDFBOEQyOUNDM0I3MDlEQjMKUldTem5YQTd6Q21OR2c3dS9rWG9pUjUyOEoyeGpVd0RmSHQ0N3QxeTE0VWVKSEEzcjJmWHdlWmoK"
},
"windows": [
{
"fullscreen": false,
"height": 600,
"resizable": true,
"title": "NextChat",
"title": "AIChat",
"title": "AIChat",
"width": 960,
"hiddenTitle": true,
"titleBarStyle": "Overlay"

0 comments on commit 8ab1f39

Please sign in to comment.