From 972f9576339fa0cf3f24ef112936afe151d662da Mon Sep 17 00:00:00 2001 From: quangdn-ght Date: Tue, 1 Jul 2025 16:50:18 +0700 Subject: [PATCH] loi he thong --- Chebichat.md | 4 +- NextChat.code-workspace | 7 ++ app/api/alibaba.ts | 12 +-- app/api/upstash/[action]/[...key]/route.ts | 10 +- app/components/chat.tsx | 1 + app/components/home.tsx | 12 ++- app/components/sidebar.tsx | 1 + app/store/chat.ts | 3 + app/store/mask.ts | 2 +- ecosystem.config.js | 13 +++ package-lock.json | 105 +++++++++++++++++++++ run.sh | 2 + 12 files changed, 154 insertions(+), 18 deletions(-) create mode 100644 NextChat.code-workspace create mode 100644 ecosystem.config.js create mode 100644 run.sh diff --git a/Chebichat.md b/Chebichat.md index 7148a47cc..65f6151f9 100644 --- a/Chebichat.md +++ b/Chebichat.md @@ -1,2 +1,4 @@ -app/store/config.ts \ No newline at end of file +app/store/config.ts + +comment detail in vietnamese \ No newline at end of file diff --git a/NextChat.code-workspace b/NextChat.code-workspace new file mode 100644 index 000000000..362d7c25b --- /dev/null +++ b/NextChat.code-workspace @@ -0,0 +1,7 @@ +{ + "folders": [ + { + "path": "." + } + ] +} \ No newline at end of file diff --git a/app/api/alibaba.ts b/app/api/alibaba.ts index dc41c0cb1..823392c0b 100644 --- a/app/api/alibaba.ts +++ b/app/api/alibaba.ts @@ -27,7 +27,7 @@ export async function handle( const response = await request(req); return response; } catch (e) { - console.error("[Alibaba] ", e); + // console.error("[Alibaba] ", e); return NextResponse.json(prettyObject(e)); } } @@ -62,13 +62,13 @@ async function request(req: NextRequest) { const fetchUrl = `${baseUrl}${path}`; - console.log("[Alibaba] fetchUrl", fetchUrl); + // console.log("[Alibaba] fetchUrl", fetchUrl); const fetchOptions: RequestInit = { headers: { "Content-Type": "application/json", 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, body: req.body, @@ -78,7 +78,7 @@ async function request(req: NextRequest) { signal: controller.signal, }; - console.log("[Proxy] Alibaba options: ", fetchOptions); + // console.log("[Proxy] Alibaba options: ", fetchOptions); // #1815 try to refuse some request to some models if (serverConfig.customModels && req.body) { @@ -100,7 +100,7 @@ async function request(req: NextRequest) { } 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) if (current_model && current_model.startsWith("qwen-vl")) { @@ -156,7 +156,7 @@ async function request(req: NextRequest) { // ); // } } catch (e) { - console.error(`[Alibaba] filter`, e); + // console.error(`[Alibaba] filter`, e); } } try { diff --git a/app/api/upstash/[action]/[...key]/route.ts b/app/api/upstash/[action]/[...key]/route.ts index fcfef4718..9d178e6de 100644 --- a/app/api/upstash/[action]/[...key]/route.ts +++ b/app/api/upstash/[action]/[...key]/route.ts @@ -55,13 +55,13 @@ async function handle( duplex: "half", }; - console.log("[Upstash Proxy]", targetUrl, fetchOptions); + // console.log("[Upstash Proxy]", targetUrl, fetchOptions); const fetchResult = await fetch(targetUrl, fetchOptions); - console.log("[Any Proxy]", targetUrl, { - status: fetchResult.status, - statusText: fetchResult.statusText, - }); + // console.log("[Any Proxy]", targetUrl, { + // status: fetchResult.status, + // statusText: fetchResult.statusText, + // }); return fetchResult; } diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 3c65f1f08..4712b03f5 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -515,6 +515,7 @@ export function ChatActions(props: { function nextTheme() { //, Theme.Dark + const themes = [Theme.Auto, Theme.Light]; const themeIndex = themes.indexOf(theme); const nextIndex = (themeIndex + 1) % themes.length; diff --git a/app/components/home.tsx b/app/components/home.tsx index 4ae0874a1..3f2174be9 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -90,11 +90,13 @@ export function useSwitchTheme() { document.body.classList.remove("light"); document.body.classList.remove("dark"); - if (config.theme === "dark") { - document.body.classList.add("dark"); - } else if (config.theme === "light") { - document.body.classList.add("light"); - } + // if (config.theme === "dark") { + // document.body.classList.add("dark"); + // } else if (config.theme === "light") { + // document.body.classList.add("light"); + // } + + document.body.classList.add("light"); const metaDescriptionDark = document.querySelector( 'meta[name="theme-color"][media*="dark"]', diff --git a/app/components/sidebar.tsx b/app/components/sidebar.tsx index 38fbfec73..ede6b2d5f 100644 --- a/app/components/sidebar.tsx +++ b/app/components/sidebar.tsx @@ -310,6 +310,7 @@ export function SideBar(props: { className?: string }) { }), ]} onClose={() => setshowDiscoverySelector(false)} + // dong bo du lieu voi cloud onSelection={async (s) => { console.log(s[0]); if (s[0] == "/sync") { diff --git a/app/store/chat.ts b/app/store/chat.ts index 4063f9d74..24cfd24b2 100644 --- a/app/store/chat.ts +++ b/app/store/chat.ts @@ -471,6 +471,9 @@ export const useChatStore = createPersistStore( }); const api: ClientApi = getClientApi(modelConfig.providerName); + + console.log(api); + // make request api.llm.chat({ messages: sendMessages, diff --git a/app/store/mask.ts b/app/store/mask.ts index 981bdab44..4a1851260 100644 --- a/app/store/mask.ts +++ b/app/store/mask.ts @@ -97,7 +97,7 @@ export const useMaskStore = createPersistStore( ); 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 diff --git a/ecosystem.config.js b/ecosystem.config.js new file mode 100644 index 000000000..654e7ceb9 --- /dev/null +++ b/ecosystem.config.js @@ -0,0 +1,13 @@ +module.exports = { + apps: [ + { + name: 'chebi-nextjs', + script: './start.sh', + instances: 'max', + exec_mode: 'cluster', + env: { + NODE_ENV: 'production' + } + } + ] +} diff --git a/package-lock.json b/package-lock.json index 221ee60c1..b965d0d9a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17617,6 +17617,111 @@ "type": "github", "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" + } } } } diff --git a/run.sh b/run.sh new file mode 100644 index 000000000..5a57bb434 --- /dev/null +++ b/run.sh @@ -0,0 +1,2 @@ +# yarn build && pm2 start "yarn start" --name "chebi-nextjs" -i max +pm2 start "yarn start" --name "chebi-nextjs" -i max \ No newline at end of file