Skip to content

Commit cdeb278

Browse files
committed
thay doi ui chebichat
1 parent e3fc9ee commit cdeb278

File tree

29 files changed

+615
-1123
lines changed

29 files changed

+615
-1123
lines changed

app/SyncOnFirstLoad.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"use client";
2+
import { useEffect } from "react";
3+
import { useSyncStore } from "./store/sync";
4+
5+
export default function SyncOnFirstLoad() {
6+
const syncStore = useSyncStore();
7+
8+
useEffect(() => {
9+
if (syncStore.lastSyncTime === 0) {
10+
syncStore.sync();
11+
}
12+
}, []);
13+
14+
return null;
15+
}

app/api/common.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export async function requestOpenai(req: NextRequest) {
3232
let baseUrl =
3333
(isAzure ? serverConfig.azureUrl : serverConfig.baseUrl) || OPENAI_BASE_URL;
3434

35+
// console.log("[Base Url]", baseUrl);
36+
3537
if (!baseUrl.startsWith("http")) {
3638
baseUrl = `https://${baseUrl}`;
3739
}

app/client/platforms/alibaba.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ export class QwenApi implements LLMApi {
204204
// Accumulate and render result as it streams
205205
onUpdate: (() => {
206206
let accumulated = "";
207-
return (chunk: string) => {
207+
return (chunk: string, fetchText?: string) => {
208208
accumulated += chunk;
209-
options.onUpdate?.(accumulated, chunk);
209+
options.onUpdate?.(accumulated, fetchText ?? "");
210210
};
211211
})(),
212212
onFinish: (final: string, res: any) => {

app/components/chat.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@
357357
font-size: 12px;
358358
color: var(--black);
359359
margin-left: 6px;
360+
display: none;
360361
}
361362
}
362363

app/components/chat.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,18 +1330,32 @@ function _Chat() {
13301330
}
13311331
}
13321332

1333+
// Sử dụng useMemo để tạo mảng context chứa các tin nhắn ngữ cảnh (context messages) của phiên chat hiện tại.
1334+
// Nếu mask được thiết lập ẩn context (hideContext), trả về mảng rỗng.
1335+
// Ngược lại, sao chép các tin nhắn context từ session.mask.context.
13331336
const context: RenderMessage[] = useMemo(() => {
13341337
return session.mask.hideContext ? [] : session.mask.context.slice();
13351338
}, [session.mask.context, session.mask.hideContext]);
13361339

1340+
// Nếu không có tin nhắn context nào (context.length === 0)
1341+
// và tin nhắn đầu tiên của session không phải là lời chào mặc định của bot (BOT_HELLO),
1342+
// thì thêm tin nhắn chào mặc định của bot vào context.
1343+
// Nếu người dùng chưa đăng nhập (không có quyền truy cập), thay nội dung lời chào bằng thông báo lỗi chưa đăng nhập.
13371344
if (
13381345
context.length === 0 &&
13391346
session.messages.at(0)?.content !== BOT_HELLO.content
13401347
) {
1348+
// sao chép lời chào mặc định của bot
1349+
13411350
const copiedHello = Object.assign({}, BOT_HELLO);
1351+
1352+
// nếu người dùng chưa đăng nhập, thay nội dung lời chào bằng thông báo lỗi chưa đăng nhập
13421353
if (!accessStore.isAuthorized()) {
13431354
copiedHello.content = Locale.Error.Unauthorized;
13441355
}
1356+
// thêm lời chào vào context
1357+
// để hiển thị lời chào này trong giao diện chat
1358+
// như là một phần của ngữ cảnh cuộc trò chuyện
13451359
context.push(copiedHello);
13461360
}
13471361

app/components/emoji.tsx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,22 @@ import EmojiPicker, {
66

77
import { ModelType } from "../store";
88

9-
import BotIconDefault from "../icons/llm-icons/default.svg";
10-
import BotIconOpenAI from "../icons/llm-icons/openai.svg";
9+
// import BotIconDefault from "../icons/llm-icons/chebichat.svg";
10+
11+
import BotIconDefault from "../icons/llm-icons/chebichat.svg";
12+
13+
import BotIconOpenAI from "../icons/llm-icons/chebichat.svg";
1114
import BotIconGemini from "../icons/llm-icons/gemini.svg";
1215
import BotIconGemma from "../icons/llm-icons/gemma.svg";
1316
import BotIconClaude from "../icons/llm-icons/claude.svg";
1417
import BotIconMeta from "../icons/llm-icons/meta.svg";
1518
import BotIconMistral from "../icons/llm-icons/mistral.svg";
1619
import BotIconDeepseek from "../icons/llm-icons/deepseek.svg";
1720
import BotIconMoonshot from "../icons/llm-icons/moonshot.svg";
18-
import BotIconQwen from "../icons/llm-icons/qwen.svg";
21+
22+
// thay bang chebichat
23+
import BotIconQwen from "../icons/llm-icons/chebichat.svg";
24+
1925
import BotIconWenxin from "../icons/llm-icons/wenxin.svg";
2026
import BotIconGrok from "../icons/llm-icons/grok.svg";
2127
import BotIconHunyuan from "../icons/llm-icons/hunyuan.svg";
@@ -68,7 +74,10 @@ export function Avatar(props: { model?: ModelType; avatar?: string }) {
6874
LlmIcon = BotIconClaude;
6975
} else if (modelName.includes("llama")) {
7076
LlmIcon = BotIconMeta;
71-
} else if (modelName.startsWith("mixtral") || modelName.startsWith("codestral")) {
77+
} else if (
78+
modelName.startsWith("mixtral") ||
79+
modelName.startsWith("codestral")
80+
) {
7281
LlmIcon = BotIconMistral;
7382
} else if (modelName.includes("deepseek")) {
7483
LlmIcon = BotIconDeepseek;
@@ -93,15 +102,15 @@ export function Avatar(props: { model?: ModelType; avatar?: string }) {
93102
}
94103

95104
return (
96-
<div className="no-dark">
97-
<LlmIcon className="user-avatar" width={30} height={30} />
105+
<div className="user-avatar">
106+
<LlmIcon className="user-avatar" size={48} width={48} height={48} />
98107
</div>
99108
);
100109
}
101110

102111
return (
103112
<div className="user-avatar">
104-
{props.avatar && <EmojiAvatar avatar={props.avatar} />}
113+
{props.avatar && <EmojiAvatar avatar={props.avatar} size={48} />}
105114
</div>
106115
);
107116
}

app/components/exporter.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ export function ImagePreviewer(props: {
523523
/>
524524
</div>
525525

526-
<div>
526+
{/* <div>
527527
<div className={styles["main-title"]}>NextChat</div>
528528
<div className={styles["sub-title"]}>
529529
github.com/ChatGPTNextWeb/ChatGPT-Next-Web
@@ -536,7 +536,8 @@ export function ImagePreviewer(props: {
536536
model={session.mask.modelConfig.model}
537537
/>
538538
</div>
539-
</div>
539+
</div> */}
540+
540541
<div>
541542
<div className={styles["chat-info-item"]}>
542543
{Locale.Exporter.Model}: {mask.modelConfig.model}

app/components/sidebar.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import styles from "./home.module.scss";
55
import { IconButton } from "./button";
66
import SettingsIcon from "../icons/settings.svg";
77
import GithubIcon from "../icons/github.svg";
8-
import ChatGptIcon from "../icons/chatgpt.svg";
8+
9+
import ChatGptIcon from "../icons/chebichat.svg";
10+
911
import AddIcon from "../icons/add.svg";
1012
import DeleteIcon from "../icons/delete.svg";
1113
import MaskIcon from "../icons/mask.svg";
@@ -250,8 +252,8 @@ export function SideBar(props: { className?: string }) {
250252
{...props}
251253
>
252254
<SideBarHeader
253-
title="NextChat"
254-
subTitle="Build your own AI assistant."
255+
title="Chebi Chat"
256+
subTitle="Trợ lý AI học tiếng Trung"
255257
logo={<ChatGptIcon />}
256258
shouldNarrow={shouldNarrow}
257259
>

app/constant.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,11 @@ export const ACCESS_CODE_PREFIX = "nk-";
110110
export const LAST_INPUT_KEY = "last-input";
111111
export const UNFINISHED_INPUT = (id: string) => "unfinished-input-" + id;
112112

113-
export const STORAGE_KEY = "chatgpt-next-web";
113+
// The key used to store the last chat ID in local storage
114+
export const UPSTASH_ENDPOINT = "https://fine-baboon-52580.upstash.io";
115+
export const UPSTASH_APIKEY =
116+
"Ac1kAAIjcDE2YjM4YmY3OGI4YzA0MTU2YjZhNmQyNzc5Yzc3NzEwYnAxMA";
117+
export const STORAGE_KEY = "chebichat-backup";
114118

115119
export const REQUEST_TIMEOUT_MS = 60000;
116120
export const REQUEST_TIMEOUT_MS_FOR_THINKING = REQUEST_TIMEOUT_MS * 5;
@@ -599,15 +603,15 @@ const bytedanceModels = [
599603

600604
const alibabaModes = [
601605
"qwen-turbo",
602-
"qwen-plus",
606+
// "qwen-plus",
603607
"qwen-max",
604-
"qwen-max-0428",
605-
"qwen-max-0403",
606-
"qwen-max-0107",
607-
"qwen-max-longcontext",
608-
"qwen-omni-turbo",
608+
// "qwen-max-0428",
609+
// "qwen-max-0403",
610+
// "qwen-max-0107",
611+
// "qwen-max-longcontext",
612+
// "qwen-omni-turbo",
609613
"qwen-vl-plus",
610-
"qwen-vl-max",
614+
// "qwen-vl-max",
611615
];
612616

613617
const tencentModels = [

0 commit comments

Comments
 (0)