Procházet zdrojové kódy

feat(side-panel): 本地化聊天窗口并调整样式

- 将聊天历史和输入框的文本本地化为中文
- 更新消息类型图标和背景颜色
- 移除 Discord 链接按钮- 注释掉模板列表组件- 调整侧边面板的背景样式
wzg před 3 měsíci
rodič
revize
91880eabeb

+ 1 - 3
pages/side-panel/public/icons/navigator.svg

@@ -1,3 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
-  <path fill="rgba(255, 255, 255, 0.9)"  d="M12 2L4.5 20.29l.71.71L12 18l6.79 3 .71-.71L12 2zm0 15l-4.5 2 2.5-7h4l2.5 7-4.5-2z"/>
-</svg> 
+<svg t="1746669843669" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10649" width="32" height="32"><path d="M713.2405 353.93916L277.986702 549.976229l182.384676 27.869225 93.767596 307.9373 101.458091-301.481517z" fill="#25B195" p-id="10650"></path><path d="M500.129121 929.032969c-4.762463-4.762463-7.937438-11.041858-8.784097-18.026802l-37.958591-318.732215-317.003617-36.335825c-13.54656-1.55221-24.517863-12.029628-26.705068-25.470356-2.187205-13.440728 4.868295-26.881455 17.21542-32.666965l719.661006-337.782065c11.641575-5.468013 25.54091-3.033865 34.642505 6.06773 9.101595 9.101595 11.535743 23.00093 6.06773 34.642505l-337.782065 719.661006c-5.78551 12.311848-19.19096 19.367348-32.59641 17.21542-6.526338-1.023048-12.311848-4.127468-16.756813-8.572433z m1.234713-384.912805c4.727185 4.727185 7.866883 10.971303 8.713542 17.991525l28.610053 240.169222L798.541496 248.706377l-552.798429 259.466014 237.452854 27.23423c7.090778 0.811383 13.40545 3.986358 18.167913 8.713543z m-24.976471 50.7996h-0.035277c0-0.035278 0.035278 0 0.035277 0zM871.953974 214.240259l-0.070555 0.035278c0.035278-0.035278 0.070555-0.035278 0.070555-0.035278z" fill="#666767" p-id="10651"></path></svg>

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 3
pages/side-panel/public/icons/planner.svg


+ 1 - 3
pages/side-panel/public/icons/system.svg

@@ -1,3 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
-  <path fill="rgba(255, 255, 255, 0.9)" d="M12 3L1 9l4 2.18v6L12 21l7-3.82v-6l2-1.09V17h2V9L12 3zm6.82 6L12 12.72 5.18 9 12 5.28 18.82 9zM17 15.99l-5 2.73-5-2.73v-3.72L12 15l5-2.73v3.72z"/>
-</svg> 
+<svg t="1746669940120" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="19251" width="32" height="32"><path d="M501.703 434.412a133.858 133.858 0 0 1-57.57-12.06L123.453 265.453c-24.69-7.737-37.034-24.12-37.034-44.259 0-20.081 12.345-36.238 32.881-48.241L444.19 12.131A153.029 153.029 0 0 1 505.856 0.014c19.91-0.284 39.594 3.869 57.57 12.117l320.736 152.802c20.593 12.06 32.938 28.16 32.938 48.24s-12.345 36.239-32.938 48.242L559.558 422.351c-12.629 8.079-37.318 12.06-57.855 12.06z m-65.82 563.192a98.587 98.587 0 0 1-32.88-7.85L119.3 844.801c-32.88-16.156-61.666-52.337-61.666-80.496v-397.99a46.25 46.25 0 0 1 13.994-34.587 48.355 48.355 0 0 1 35.328-13.653c10.012 0.74 19.797 3.413 28.785 7.793l287.854 144.78c32.938 16.1 61.723 52.338 61.723 80.44v394.235a49.265 49.265 0 0 1-13.482 36.237 51.484 51.484 0 0 1-35.953 15.986z m152.176 0a48.355 48.355 0 0 1-35.327-13.653 46.25 46.25 0 0 1-13.995-34.645V555.128c0-32.141 24.69-64.34 61.667-80.383L888.258 325.87c8.931-4.437 18.773-7.054 28.728-7.793a48.355 48.355 0 0 1 35.328 13.653c9.386 9.102 14.45 21.617 13.994 34.588v393.95c0 32.198-24.69 64.397-61.666 80.44L616.788 989.753a60.415 60.415 0 0 1-28.729 7.794z" fill="#1296DB" p-id="19252"></path></svg>

binární
pages/side-panel/public/icons/user1.png


+ 1 - 3
pages/side-panel/public/icons/validator.svg

@@ -1,3 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
-  <path fill="rgba(255, 255, 255, 0.9)" d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
-</svg> 
+<svg t="1746670322591" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="20368" width="32" height="32"><path d="M510.296 64c60.32 34.104 188.892 62.696 385.704 85.776v518.952C896 763.232 538.452 960 510.296 960c-28.16 0-381.032-196.768-381.688-291.272-0.4-57-0.56-100.24-0.6-139.96L128 516.544v-12.068l0.008-11.98c0.072-79.712 0.564-158 0.6-325.652v-17.068c179.688-23.08 306.92-51.672 381.688-85.776z m182.688 302.704l-215.468 215.464-121.368-121.372-50.912 50.912 172.28 172.284 266.38-266.376-50.912-50.912z" fill="#627BFD" p-id="20369"></path></svg>

+ 10 - 17
pages/side-panel/src/SidePanel.tsx

@@ -539,7 +539,7 @@ const SidePanel = () => {
   return (
     <div>
       <div
-        className={`flex h-screen flex-col ${isDarkMode ? 'bg-slate-900' : "bg-[url('/bg.jpg')] bg-cover bg-no-repeat"} overflow-hidden border ${isDarkMode ? 'border-sky-800' : 'border-[rgb(186,230,253)]'} rounded-2xl`}>
+        className={`flex h-screen flex-col ${isDarkMode ? 'bg-slate-900' : ''} overflow-hidden border ${isDarkMode ? 'border-sky-800' : 'border-[rgb(186,230,253)]'} rounded-2xl`}>
         <header className="header relative">
           <div className="header-logo">
             {showHistory ? (
@@ -547,8 +547,8 @@ const SidePanel = () => {
                 type="button"
                 onClick={handleBackToChat}
                 className={`${isDarkMode ? 'text-sky-400 hover:text-sky-300' : 'text-sky-400 hover:text-sky-500'} cursor-pointer`}
-                aria-label="Back to chat">
-                ← Back
+                aria-label="返回聊天">
+                ← 返回
               </button>
             ) : (
               <img src="/icon-128.png" alt="Extension Logo" className="size-6" />
@@ -577,13 +577,6 @@ const SidePanel = () => {
                 </button>
               </>
             )}
-            <a
-              href="https://discord.gg/NN3ABHggMK"
-              target="_blank"
-              rel="noopener noreferrer"
-              className={`header-icon ${isDarkMode ? 'text-sky-400 hover:text-sky-300' : 'text-sky-400 hover:text-sky-500'}`}>
-              <RxDiscordLogo size={20} />
-            </a>
             <button
               type="button"
               onClick={() => chrome.runtime.openOptionsPage()}
@@ -622,13 +615,13 @@ const SidePanel = () => {
                     isDarkMode={isDarkMode}
                   />
                 </div>
-                <div>
-                  <TemplateList
-                    templates={defaultTemplates}
-                    onTemplateSelect={handleTemplateSelect}
-                    isDarkMode={isDarkMode}
-                  />
-                </div>
+                {/*<div>*/}
+                {/*  <TemplateList*/}
+                {/*    templates={defaultTemplates}*/}
+                {/*    onTemplateSelect={handleTemplateSelect}*/}
+                {/*    isDarkMode={isDarkMode}*/}
+                {/*  />*/}
+                {/*</div>*/}
               </>
             )}
             <div

+ 2 - 2
pages/side-panel/src/components/ChatHistoryList.tsx

@@ -31,11 +31,11 @@ const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
 
   return (
     <div className="h-full overflow-y-auto p-4">
-      <h2 className={`mb-4 text-lg font-semibold ${isDarkMode ? 'text-gray-200' : 'text-gray-800'}`}>Chat History</h2>
+      <h2 className={`mb-4 text-lg font-semibold ${isDarkMode ? 'text-gray-200' : 'text-gray-800'}`}>历史对话</h2>
       {sessions.length === 0 ? (
         <div
           className={`rounded-lg ${isDarkMode ? 'bg-slate-800 text-gray-400' : 'bg-white/30 text-gray-500'} p-4 text-center backdrop-blur-sm`}>
-          No chat history available
+          暂无历史
         </div>
       ) : (
         <div className="space-y-2">

+ 3 - 3
pages/side-panel/src/components/ChatInput.tsx

@@ -94,7 +94,7 @@ export default function ChatInput({
                 ? 'bg-slate-800 text-gray-200'
                 : 'bg-white'
           }`}
-          placeholder="What can I help with?"
+          placeholder="我可以帮助什么?"
           aria-label="Message input"
         />
 
@@ -109,7 +109,7 @@ export default function ChatInput({
               type="button"
               onClick={onStopTask}
               className="rounded-md bg-red-500 px-3 py-1 text-white transition-colors hover:bg-red-600">
-              Stop
+              停止
             </button>
           ) : (
             <button
@@ -117,7 +117,7 @@ export default function ChatInput({
               disabled={isSendButtonDisabled}
               aria-disabled={isSendButtonDisabled}
               className={`rounded-md bg-[#19C2FF] px-3 py-1 text-white transition-colors hover:enabled:bg-[#0073DC] ${isSendButtonDisabled ? 'cursor-not-allowed opacity-50' : ''}`}>
-              Send
+              发送
             </button>
           )}
         </div>

+ 15 - 15
pages/side-panel/src/types/message.ts

@@ -1,37 +1,37 @@
 export const ACTOR_PROFILES = {
   user: {
-    name: 'User',
-    icon: 'icons/user.svg',
-    iconBackground: '#4CAF50',
+    name: '用户', // User
+    icon: 'icons/user1.png',
+    iconBackground: '#ffffff',
   },
   system: {
-    name: 'System',
+    name: '系统', // System
     icon: 'icons/system.svg',
-    iconBackground: '#2196F3',
+    iconBackground: '#ffffff',
   },
   planner: {
-    name: 'Planner',
+    name: '策划员', // Planner
     icon: 'icons/planner.svg',
-    iconBackground: '#FF9800',
+    iconBackground: '#ffffff',
   },
   navigator: {
-    name: 'Navigator',
+    name: '领航员', // Navigator
     icon: 'icons/navigator.svg',
-    iconBackground: '#40A9FF',
+    iconBackground: '#ffffff',
   },
   validator: {
-    name: 'Validator',
+    name: '验码者', // Validator
     icon: 'icons/validator.svg',
-    iconBackground: '#EC407A',
+    iconBackground: '#ffffff',
   },
   manager: {
-    name: 'Manager',
+    name: '经理', // Manager
     icon: 'icons/manager.svg',
-    iconBackground: '#9C27B0',
+    iconBackground: '#ffffff',
   },
   evaluator: {
-    name: 'Evaluator',
+    name: '评估员', // Evaluator
     icon: 'icons/evaluator.svg',
-    iconBackground: '#795548',
+    iconBackground: '#ffffff',
   },
 } as const;

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů