loi he thong

This commit is contained in:
quangdn-ght 2025-07-01 16:50:18 +07:00
parent 4ec717f94a
commit 972f957633
12 changed files with 154 additions and 18 deletions

View File

@ -1,2 +1,4 @@
<!-- comment detail in vietnamese --> <!-- comment detail in vietnamese -->
app/store/config.ts app/store/config.ts
comment detail in vietnamese

7
NextChat.code-workspace Normal file
View File

@ -0,0 +1,7 @@
{
"folders": [
{
"path": "."
}
]
}

View File

@ -27,7 +27,7 @@ export async function handle(
const response = await request(req); const response = await request(req);
return response; return response;
} catch (e) { } catch (e) {
console.error("[Alibaba] ", e); // console.error("[Alibaba] ", e);
return NextResponse.json(prettyObject(e)); return NextResponse.json(prettyObject(e));
} }
} }
@ -62,13 +62,13 @@ async function request(req: NextRequest) {
const fetchUrl = `${baseUrl}${path}`; const fetchUrl = `${baseUrl}${path}`;
console.log("[Alibaba] fetchUrl", fetchUrl); // console.log("[Alibaba] fetchUrl", fetchUrl);
const fetchOptions: RequestInit = { const fetchOptions: RequestInit = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
Authorization: req.headers.get("Authorization") ?? "", Authorization: req.headers.get("Authorization") ?? "",
"X-DashScope-SSE": req.headers.get("X-DashScope-SSE") ?? "disable", "X-DashScope-SSE": req.headers.get("X-DashScope-SSE") ?? "enable",
}, },
method: req.method, method: req.method,
body: req.body, body: req.body,
@ -78,7 +78,7 @@ async function request(req: NextRequest) {
signal: controller.signal, signal: controller.signal,
}; };
console.log("[Proxy] Alibaba options: ", fetchOptions); // console.log("[Proxy] Alibaba options: ", fetchOptions);
// #1815 try to refuse some request to some models // #1815 try to refuse some request to some models
if (serverConfig.customModels && req.body) { if (serverConfig.customModels && req.body) {
@ -100,7 +100,7 @@ async function request(req: NextRequest) {
} }
const current_model = jsonBody?.model; const current_model = jsonBody?.model;
console.log("[Alibaba] custom models", current_model); // console.log("[Alibaba] custom models", current_model);
//kiem tra xem model co phai la qwen-vl hay khong (vision model) //kiem tra xem model co phai la qwen-vl hay khong (vision model)
if (current_model && current_model.startsWith("qwen-vl")) { if (current_model && current_model.startsWith("qwen-vl")) {
@ -156,7 +156,7 @@ async function request(req: NextRequest) {
// ); // );
// } // }
} catch (e) { } catch (e) {
console.error(`[Alibaba] filter`, e); // console.error(`[Alibaba] filter`, e);
} }
} }
try { try {

View File

@ -55,13 +55,13 @@ async function handle(
duplex: "half", duplex: "half",
}; };
console.log("[Upstash Proxy]", targetUrl, fetchOptions); // console.log("[Upstash Proxy]", targetUrl, fetchOptions);
const fetchResult = await fetch(targetUrl, fetchOptions); const fetchResult = await fetch(targetUrl, fetchOptions);
console.log("[Any Proxy]", targetUrl, { // console.log("[Any Proxy]", targetUrl, {
status: fetchResult.status, // status: fetchResult.status,
statusText: fetchResult.statusText, // statusText: fetchResult.statusText,
}); // });
return fetchResult; return fetchResult;
} }

View File

@ -515,6 +515,7 @@ export function ChatActions(props: {
function nextTheme() { function nextTheme() {
//, Theme.Dark //, Theme.Dark
const themes = [Theme.Auto, Theme.Light]; const themes = [Theme.Auto, Theme.Light];
const themeIndex = themes.indexOf(theme); const themeIndex = themes.indexOf(theme);
const nextIndex = (themeIndex + 1) % themes.length; const nextIndex = (themeIndex + 1) % themes.length;

View File

@ -90,11 +90,13 @@ export function useSwitchTheme() {
document.body.classList.remove("light"); document.body.classList.remove("light");
document.body.classList.remove("dark"); document.body.classList.remove("dark");
if (config.theme === "dark") { // if (config.theme === "dark") {
document.body.classList.add("dark"); // document.body.classList.add("dark");
} else if (config.theme === "light") { // } else if (config.theme === "light") {
// document.body.classList.add("light");
// }
document.body.classList.add("light"); document.body.classList.add("light");
}
const metaDescriptionDark = document.querySelector( const metaDescriptionDark = document.querySelector(
'meta[name="theme-color"][media*="dark"]', 'meta[name="theme-color"][media*="dark"]',

View File

@ -310,6 +310,7 @@ export function SideBar(props: { className?: string }) {
}), }),
]} ]}
onClose={() => setshowDiscoverySelector(false)} onClose={() => setshowDiscoverySelector(false)}
// dong bo du lieu voi cloud
onSelection={async (s) => { onSelection={async (s) => {
console.log(s[0]); console.log(s[0]);
if (s[0] == "/sync") { if (s[0] == "/sync") {

View File

@ -471,6 +471,9 @@ export const useChatStore = createPersistStore(
}); });
const api: ClientApi = getClientApi(modelConfig.providerName); const api: ClientApi = getClientApi(modelConfig.providerName);
console.log(api);
// make request // make request
api.llm.chat({ api.llm.chat({
messages: sendMessages, messages: sendMessages,

View File

@ -97,7 +97,7 @@ export const useMaskStore = createPersistStore(
); );
const config = useAppConfig.getState(); // Lấy config hiện tại const config = useAppConfig.getState(); // Lấy config hiện tại
// console.log(config) // console.log(config)BUILTIN_MASKS
if (config.hideBuiltinMasks) return userMasks; // Nếu ẩn mask mặc định thì chỉ trả về mask người dùng if (config.hideBuiltinMasks) return userMasks; // Nếu ẩn mask mặc định thì chỉ trả về mask người dùng

13
ecosystem.config.js Normal file
View File

@ -0,0 +1,13 @@
module.exports = {
apps: [
{
name: 'chebi-nextjs',
script: './start.sh',
instances: 'max',
exec_mode: 'cluster',
env: {
NODE_ENV: 'production'
}
}
]
}

105
package-lock.json generated
View File

@ -17617,6 +17617,111 @@
"type": "github", "type": "github",
"url": "https://github.com/sponsors/wooorm" "url": "https://github.com/sponsors/wooorm"
} }
},
"node_modules/@next/swc-darwin-arm64": {
"version": "14.1.1",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.1.1.tgz",
"integrity": "sha512-yDjSFKQKTIjyT7cFv+DqQfW5jsD+tVxXTckSe1KIouKk75t1qZmj/mV3wzdmFb0XHVGtyRjDMulfVG8uCKemOQ==",
"cpu": [
"arm64"
],
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-darwin-x64": {
"version": "14.1.1",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.1.1.tgz",
"integrity": "sha512-KCQmBL0CmFmN8D64FHIZVD9I4ugQsDBBEJKiblXGgwn7wBCSe8N4Dx47sdzl4JAg39IkSN5NNrr8AniXLMb3aw==",
"cpu": [
"x64"
],
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-linux-arm64-gnu": {
"version": "14.1.1",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.1.1.tgz",
"integrity": "sha512-YDQfbWyW0JMKhJf/T4eyFr4b3tceTorQ5w2n7I0mNVTFOvu6CGEzfwT3RSAQGTi/FFMTFcuspPec/7dFHuP7Eg==",
"cpu": [
"arm64"
],
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-linux-arm64-musl": {
"version": "14.1.1",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.1.1.tgz",
"integrity": "sha512-fiuN/OG6sNGRN/bRFxRvV5LyzLB8gaL8cbDH5o3mEiVwfcMzyE5T//ilMmaTrnA8HLMS6hoz4cHOu6Qcp9vxgQ==",
"cpu": [
"arm64"
],
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-win32-arm64-msvc": {
"version": "14.1.1",
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.1.1.tgz",
"integrity": "sha512-1L4mUYPBMvVDMZg1inUYyPvFSduot0g73hgfD9CODgbr4xiTYe0VOMTZzaRqYJYBA9mana0x4eaAaypmWo1r5A==",
"cpu": [
"arm64"
],
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-win32-ia32-msvc": {
"version": "14.1.1",
"resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.1.1.tgz",
"integrity": "sha512-jvIE9tsuj9vpbbXlR5YxrghRfMuG0Qm/nZ/1KDHc+y6FpnZ/apsgh+G6t15vefU0zp3WSpTMIdXRUsNl/7RSuw==",
"cpu": [
"ia32"
],
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-win32-x64-msvc": {
"version": "14.1.1",
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.1.1.tgz",
"integrity": "sha512-S6K6EHDU5+1KrBDLko7/c1MNy/Ya73pIAmvKeFwsF4RmBFJSO7/7YeD4FnZ4iBdzE69PpQ4sOMU9ORKeNuxe8A==",
"cpu": [
"x64"
],
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 10"
}
} }
} }
} }

2
run.sh Normal file
View File

@ -0,0 +1,2 @@
# yarn build && pm2 start "yarn start" --name "chebi-nextjs" -i max
pm2 start "yarn start" --name "chebi-nextjs" -i max