李富豪 1 rok pred
rodič
commit
7e575494bb

+ 2 - 2
app/client/platforms/bigmodel.ts

@@ -16,7 +16,7 @@ import { getMessageTextContent } from "@/app/utils";
 
 export class BigModelApi implements LLMApi {
   path(): string {
-    return '/api/paas/v4/chat/completions';
+    return 'https://open.bigmodel.cn/api/paas/v4/chat/completions'
   }
 
   async chat(options: ChatOptions) {
@@ -56,7 +56,7 @@ export class BigModelApi implements LLMApi {
     options.onController?.(controller);
 
     try {
-      let chatPath = this.path();
+      const chatPath = this.path();
       const chatPayload = {
         method: "POST",
         body: JSON.stringify(requestPayload),

+ 73 - 0
app/components/Record.tsx

@@ -0,0 +1,73 @@
+import * as React from 'react';
+import { Link } from 'react-router-dom';
+import { IconButton } from './button';
+import ReturnIcon from "../icons/return.svg";
+
+const RecordApp: React.FC = () => {
+    const [account, setAccount] = React.useState('');
+    const [password, setPassword] = React.useState('');
+
+    return (
+        <div>
+            <div style={{ padding: '14px 20px', borderBottom: '1px solid rgba(0, 0, 0, 0.1)', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
+                <div>
+                    <div style={{ fontSize: 20, fontWeight: 'bolder' }}>
+                        建科招聘聊天记录
+                    </div>
+                    <div style={{ fontSize: 14 }}>
+                        输入账号密码导出聊天记录
+                    </div>
+                </div>
+                <div>
+                    <Link to='/'>
+                        <IconButton
+                            icon={<ReturnIcon />}
+                            bordered
+                            title='返回'
+                            aria='返回'
+                        />
+                    </Link>
+                </div>
+            </div>
+            <div style={{ width: '100%', padding: '20px 0', display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
+                <input
+                    style={{ width: '50%' }}
+                    type="text"
+                    placeholder="请输入账号"
+                    value={account}
+                    onChange={(e) => {
+                        const value = e.target.value;
+                        setAccount(value);
+                    }}
+                />
+                <input
+                    style={{ width: '50%', margin: '20px 0' }}
+                    type="password"
+                    placeholder="请输入密码"
+                    value={password}
+                    onChange={(e) => {
+                        const value = e.target.value;
+                        setPassword(value);
+                    }}
+                />
+                <button
+                    style={{
+                        width: '50%',
+                        border: '1px solid rgba(0, 0, 0, 0.1)',
+                        backgroundColor: '#FFFFFF',
+                        borderRadius: '10px',
+                        height: 36,
+                        cursor: 'pointer'
+                    }}
+                    onClick={() => {
+                        console.log(account, password);
+                    }}
+                >
+                    导出
+                </button>
+            </div>
+        </div>
+    );
+};
+
+export default RecordApp;

+ 3 - 4
app/components/chat-list.tsx

@@ -12,7 +12,7 @@ import {
 import { useChatStore } from "../store";
 
 import Locale from "../locales";
-import { Link, useLocation, useNavigate } from "react-router-dom";
+import { useLocation, useNavigate } from "react-router-dom";
 import { Path } from "../constant";
 import { MaskAvatar } from "./mask";
 import { Mask } from "../store/mask";
@@ -46,11 +46,10 @@ export function ChatItem(props: {
     <Draggable draggableId={`${props.id}`} index={props.index}>
       {(provided) => (
         <div
-          className={`${styles["chat-item"]} ${
-            props.selected &&
+          className={`${styles["chat-item"]} ${props.selected &&
             (currentPath === Path.Chat || currentPath === Path.Home) &&
             styles["chat-item-selected"]
-          }`}
+            }`}
           onClick={props.onClick}
           ref={(ele) => {
             draggableRef.current = ele;

+ 9 - 4
app/components/home.tsx

@@ -50,6 +50,10 @@ const Chat = dynamic(async () => (await import("./chat")).Chat, {
   loading: () => <Loading noLogo />,
 });
 
+const Record = dynamic(async () => (await import("./Record")), {
+  loading: () => <Loading noLogo />,
+});
+
 const NewChat = dynamic(async () => (await import("./new-chat")).NewChat, {
   loading: () => <Loading noLogo />,
 });
@@ -171,10 +175,11 @@ function Screen() {
         <WindowContent>
           <Routes>
             <Route path={Path.Home} element={<Chat />} />
-            <Route path={Path.NewChat} element={<NewChat />} />
-            <Route path={Path.Masks} element={<MaskPage />} />
-            <Route path={Path.Chat} element={<Chat />} />
-            <Route path={Path.Settings} element={<Settings />} />
+            <Route path={'/record'} element={<Record />} />
+            {/* <Route path={Path.NewChat} element={<NewChat />} /> */}
+            {/* <Route path={Path.Masks} element={<MaskPage />} /> */}
+            {/* <Route path={Path.Chat} element={<Chat />} /> */}
+            {/* <Route path={Path.Settings} element={<Settings />} /> */}
           </Routes>
         </WindowContent>
       </>

+ 4 - 1
app/layout.tsx

@@ -33,6 +33,7 @@ export default function RootLayout({
 }: {
   children: React.ReactNode;
 }) {
+
   return (
     <html lang="en">
       <head>
@@ -45,7 +46,9 @@ export default function RootLayout({
         <script src="/serviceWorkerRegister.js" defer></script>
       </head>
       <body>
-        {children}
+        <>
+          {children}
+        </>
         {serverConfig?.isVercel && (
           <>
             <SpeedInsights />

+ 0 - 4
next.config.mjs

@@ -62,10 +62,6 @@ if (mode !== "export") {
 
   nextConfig.rewrites = async () => {
     const ret = [
-      {
-        source: '/api/paas/v4/chat/completions',
-        destination: 'https://open.bigmodel.cn/api/paas/v4/chat/completions',
-      },
       {
         source: "/api/proxy/v1/:path*",
         destination: "https://api.openai.com/v1/:path*",