diff --git a/manifest.json b/manifest.json index 665a3f3..3a3416d 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "渠道应用开发部知识库", - "version": "1.5.0", + "version": "1.5.1", "description": "通过关键词快速搜索内部文档", "permissions": ["storage"], "host_permissions": [ diff --git a/pages/index.html b/pages/index.html index 49be53e..d92ae60 100644 --- a/pages/index.html +++ b/pages/index.html @@ -3,7 +3,9 @@ 加载中... - + + +
正在加载,请稍候...
diff --git a/pages/popup.html b/pages/popup.html index cefe1a1..4c7e4c3 100644 --- a/pages/popup.html +++ b/pages/popup.html @@ -3,7 +3,9 @@ 渠道应用开发部知识库 - + + +
diff --git a/pages/styles.css b/pages/styles.css deleted file mode 100644 index e3070d1..0000000 --- a/pages/styles.css +++ /dev/null @@ -1,574 +0,0 @@ -body { - font-family: "Microsoft YaHei", sans-serif; - width: 600px; - padding: 20px; - background-color: #fefefe; -} - -/* 新增:标签页下自动全屏自适应,内容居中不可拖拽 */ -body.fullscreen .draggable-panel { - position: fixed !important; - left: 50% !important; - top: 50% !important; - transform: translate(-50%, -50%) !important; - width: 90vw !important; - max-width: 1200px !important; - height: 94vh !important; - max-height: 98vh !important; - min-width: 360px !important; - min-height: 320px !important; - box-shadow: 0 10px 40px #3070ed22; - resize: none !important; -} - - -.header { - display: flex; - align-items: center; - justify-content: center; - margin-bottom: 15px; -} - -.logo { - width: 32px; - height: 32px; - margin-right: 10px; -} - -.title-box { - display: flex; - align-items: center; - gap: 12px; -} - -h1 { - font-size: 18px; - color: #2c3e50; - margin: 0; -} - -.oa-link { - font-size: 13px; - text-decoration: none; - color: #007bff; - background-color: #f2f2f2; - padding: 4px 8px; - border-radius: 4px; -} - -.oa-link:hover { - background-color: #e0e0e0; -} - -.container { - display: flex; - flex-direction: column; -} - -.search-bar { - display: flex; - gap: 10px; - margin-bottom: 15px; -} - -.search-bar input { - flex: 1; - padding: 8px; - font-size: 14px; - border: 1px solid #ccc; - border-radius: 4px; -} - -.search-bar button { - padding: 8px 16px; - font-size: 14px; - background-color: #007bff; - color: white; - border: none; - border-radius: 4px; - cursor: pointer; -} - -.search-bar button:hover { - background-color: #0056b3; -} - -.tag-history { - display: flex; - flex-wrap: wrap; - gap: 8px; - margin-bottom: 15px; -} - -.tag-history .tag { - background-color: #f0f0f0; - color: #333; - padding: 4px 10px; - border-radius: 12px; - font-size: 12px; - cursor: pointer; -} - -.tag-history .tag:hover { - background-color: #dcdcdc; -} - -.hidden { - display: none; -} - -#results { - list-style: none; - padding: 0; -} - -#results li { - margin-bottom: 14px; - border-bottom: 1px solid #ddd; - padding-bottom: 10px; -} - -#results a { - font-weight: bold; - color: #007bff; - text-decoration: none; - font-size: 15px; -} - -#results a:hover { - text-decoration: underline; -} - -#results .summary { - font-size: 13px; - color: #444; - margin-top: 4px; -} - -.pagination { - margin-top: 15px; - display: flex; - justify-content: center; - gap: 10px; -} - -.pagination button { - padding: 6px 12px; - font-size: 13px; - background-color: #eee; - border: 1px solid #ccc; - border-radius: 3px; - cursor: pointer; -} - -.pagination button:hover { - background-color: #ddd; -} - -/* 基础结构样式保持不变,新增按钮样式 */ - -#clearHistoryBtn { - background: #f8f8f8; - border: 1px solid #ccc; - border-radius: 4px; - font-size: 14px; - padding: 0 10px; - cursor: pointer; - line-height: 28px; - height: 32px; -} - -#clearHistoryBtn:hover { - background-color: #eee; -} - -/* 原样式基础上追加 */ -.history-wrapper { - margin-bottom: 10px; -} - -.history-header { - display: flex; - justify-content: space-between; - align-items: center; - font-size: 13px; - margin-bottom: 6px; -} - -#clearHistoryBtn { - background: #f8f8f8; - border: 1px solid #ccc; - border-radius: 4px; - font-size: 14px; - padding: 2px 8px; - cursor: pointer; - line-height: 20px; -} - -#clearHistoryBtn:hover { - background-color: #eee; -} - -.delete-icon { - width: 16px; - height: 16px; - max-width: 100%; - object-fit: contain; - cursor: pointer; - opacity: 0.6; - transition: opacity 0.2s; -} - -.delete-icon:hover { - opacity: 1; - background-color: #f0f0f0; - border-radius: 3px; -} - -.user-info { - font-size: 13px; - color: #333; - margin-left: 10px; - font-weight: normal; -} - -.logout-btn { - margin-left: 10px; - padding: 4px 10px; - font-size: 12px; - border: 1px solid #ccc; - background: #f9f9f9; - color: #333; - border-radius: 4px; - cursor: pointer; -} - -.logout-btn:hover { - background-color: #f0f0f0; - color: #d00; -} - -.user-menu { - position: absolute; - top: 16px; - right: 16px; -} - -.user-avatar { - cursor: pointer; - font-size: 18px; - padding: 4px; -} - -.user-dropdown { - position: absolute; - right: 0; - top: 30px; - background: white; - border: 1px solid #ccc; - box-shadow: 0 0 4px rgba(0,0,0,0.1); - padding: 6px 10px; - font-size: 13px; - width: 120px; - z-index: 99; -} - -.user-dropdown div { - padding: 6px 0; - cursor: pointer; -} - -.user-dropdown div:hover { - background-color: #f0f0f0; -} - -.hidden { - display: none; -} - -.llm-result-container { - margin-bottom: 14px; - max-height: 140px; - overflow-y: auto; - border: 1px solid #e0e9f4; - border-radius: 7px; - padding: 8px 12px; - background: #f8fbff; -} - -.llm-title { - background: linear-gradient(90deg, #2560de 90%, #418cfb 100%); - color: #fff; - font-size: 16px; - font-weight: bold; - padding: 12px 12px 10px 12px; - margin: 0 -10px 6px -10px; - border-bottom: 1px solid #b3cdfb; - border-radius: 8px 8px 0 0; - position: sticky; - top: 0; - z-index: 2; - letter-spacing: 1px; - box-shadow: 0 2px 6px #2764bb11; -} - - -#llmResult { - font-size: 14px; - color: #233; - line-height: 1.7; - word-break: break-all; - white-space: pre-wrap; -} - -.llm-result-container { - margin-bottom: 14px; - max-height: 300px; - min-height: 60px; - overflow: auto; - border: 1px solid #e0e9f4; - border-radius: 7px; - padding: 0 12px 8px 12px; - background: #f8fbff; - display: flex; - flex-direction: column; - resize: vertical; -} - -.llm-title { - position: sticky; - top: 0; - background: #f8fbff; - font-weight: bold; - color: #2453b5; - margin: 0 -12px 8px -12px; - padding: 8px 12px 6px 12px; - font-size: 14px; - border-bottom: 1px solid #e0e9f4; - z-index: 2; -} - -.llm-result-content { - flex: 1; - overflow-y: auto; - min-height: 44px; - font-size: 14px; - color: #233; - line-height: 1.7; - word-break: break-all; - white-space: pre-wrap; -} - -.llm-input-bar { - display: flex; - gap: 8px; - margin-top: 8px; - padding-bottom: 2px; - align-items: center; -} - -#llmInput { - flex: 1; - padding: 6px 10px; - border: 1px solid #c9dafc; - border-radius: 5px; - font-size: 14px; - outline: none; -} - -#llmSendBtn { - padding: 6px 14px; - background: #4179f6; - color: #fff; - border: none; - border-radius: 5px; - cursor: pointer; - font-size: 14px; - transition: background 0.2s; -} - -#llmSendBtn:hover { - background: #2350b8; -} - -.llm-msg-item.llm-assistant { - color: #233; /* 回答文本深灰色 */ - background: #e7eefb; - border-radius: 5px; - margin: 3px 0 9px 0; - padding: 7px 8px; - word-break: break-all; - font-weight: 500; - border: 1px solid #b3cdfb; -} -/* 只让“智能助手:”四字蓝色,其它不变 */ -.assistant-label { - color: #2560de; - font-weight: bold; - margin-right: 3px; -} - -.llm-think { - background: #fffbe6; - color: #8d7a24; - font-size: 13px; - font-style: italic; - border-left: 3px solid #ffe16a; - border-radius: 5px; - margin-bottom: 6px; - padding: 7px 10px 7px 12px; - white-space: pre-wrap; -} - -.open-tab-btn { - margin-left: 8px; - padding: 2px 10px; - background: #f8f8f8; - border: 1px solid #c9dafc; - color: #2560de; - border-radius: 4px; - font-size: 15px; - cursor: pointer; - vertical-align: middle; - transition: background 0.2s; -} -.open-tab-btn:hover { - background: #eaf1fb; - color: #1e40af; -} -.tab-bar { - display: flex; - margin-bottom: 8px; - border-bottom: 1.5px solid #e2e7f4; - background: #f8fbff; -} -.tab-btn { - flex: 1; - padding: 9px 0; - border: none; - background: #f7faff; - color: #2764bb; - font-weight: bold; - cursor: pointer; - border-bottom: 2.5px solid transparent; - font-size: 15px; - transition: background 0.2s, border-color 0.2s; -} -.tab-btn.active { - background: #e7eefb; - color: #2050b0; - border-bottom: 2.5px solid #3070ed; -} -.tab-content { - display: none; -} -.tab-content.active { - display: block; -} - -/* 调整智能助手内容区边距,避免太拥挤 */ -#tabContentAi .llm-result-container { - margin-bottom: 0; -} - -body.fullscreen #tabContentAi .llm-result-container { - resize: vertical; - overflow: auto; - min-height: 160px; - max-height: 80vh; -} - -/* 全屏模式下让整体内容区域左右/上下都留白,且居中美观 */ -body.fullscreen { - background: #f8fbff; -} - -body.fullscreen .draggable-panel { - position: fixed !important; - left: 50% !important; - top: 50% !important; - transform: translate(-50%, -50%) !important; - width: 96vw !important; - max-width: 1200px !important; - height: 94vh !important; - max-height: 98vh !important; - min-width: 420px !important; - min-height: 340px !important; - box-shadow: 0 10px 40px #3070ed22; - border-radius: 24px; - background: #fff; - /* 下面这两行:确保内部内容不贴边 */ - padding: 30px 44px 24px 44px; - display: flex; - flex-direction: column; -} - -/* 让内容整体再居中一层 */ -body.fullscreen .container { - flex: 1 1 0; - display: flex; - flex-direction: column; - min-height: 0; - height: 0; - /* 新增内边距,内容远离外壳边界 */ - padding-left: 24px; - padding-right: 24px; -} - -/* 搜索栏、Tab按钮等内容更有呼吸感 */ -.search-bar { - margin-bottom: 18px; -} -.tab-bar { - margin-bottom: 12px; -} -.tab-btn { - border-radius: 12px 12px 0 0; - margin: 0 3px; -} - -#tabContentAi .llm-result-container, -#tabContentEs { - margin-top: 8px; - margin-bottom: 8px; -} - -/* 让按钮等不贴右上角 */ -.open-tab-btn { - margin-left: 16px !important; -} -.user-menu { - top: 18px !important; - right: 22px !important; -} - -/* 保证消息内容整体有圆角和阴影 */ -.llm-result-container, -#results { - border-radius: 10px; - box-shadow: 0 2px 8px #cdd2fa2c; - border: 1px solid #e2e9f4; - background: #f8fbff; - padding: 16px 20px; -} - -/* 防止消息内容贴左边 */ -.llm-result-content { - padding-left: 4px; - padding-right: 4px; -} - -body.fullscreen .container { - height: 100%; - min-height: 0; - flex: 1 1 0; - display: flex; - flex-direction: column; -} -body.fullscreen #tabContentAi.tab-content.active { - flex: 1 1 0; - min-height: 0; - display: flex !important; - flex-direction: column; - height: 100%; -} diff --git a/styles/styles-base.css b/styles/styles-base.css new file mode 100644 index 0000000..134155b --- /dev/null +++ b/styles/styles-base.css @@ -0,0 +1,205 @@ +body { + font-family: "Microsoft YaHei", sans-serif; + width: 600px; + padding: 20px; + background-color: #fefefe; +} + +body.fullscreen { + background: #f8fbff; +} + +body.fullscreen .draggable-panel { + position: fixed !important; + left: 50% !important; + top: 50% !important; + transform: translate(-50%, -50%) !important; + width: 96vw !important; + max-width: 1200px !important; + height: 94vh !important; + max-height: 98vh !important; + min-width: 420px !important; + min-height: 340px !important; + box-shadow: 0 10px 40px #3070ed22; + border-radius: 24px; + background: #fff; + padding: 30px 44px 24px 44px; + display: flex; + flex-direction: column; +} + +body.fullscreen .container { + height: 100%; + min-height: 0; + flex: 1 1 0; + display: flex; + flex-direction: column; + padding-left: 24px; + padding-right: 24px; +} + +.header { + display: flex; + align-items: center; + justify-content: center; + margin-bottom: 15px; +} + +.logo { + width: 32px; + height: 32px; + margin-right: 10px; +} + +.title-box { + display: flex; + align-items: center; + gap: 12px; +} + +h1 { + font-size: 18px; + color: #2c3e50; + margin: 0; +} + +.oa-link { + font-size: 13px; + text-decoration: none; + color: #007bff; + background-color: #f2f2f2; + padding: 4px 8px; + border-radius: 4px; +} + +.oa-link:hover { + background-color: #e0e0e0; +} + +.container { + display: flex; + flex-direction: column; +} + +.search-bar { + display: flex; + gap: 10px; + margin-bottom: 18px; +} + +.search-bar input { + flex: 1; + padding: 8px; + font-size: 14px; + border: 1px solid #ccc; + border-radius: 4px; +} + +.search-bar button { + padding: 8px 16px; + font-size: 14px; + background-color: #007bff; + color: white; + border: none; + border-radius: 4px; + cursor: pointer; +} + +.search-bar button:hover { + background-color: #0056b3; +} + +.hidden { + display: none; +} + +.delete-icon { + width: 16px; + height: 16px; + max-width: 100%; + object-fit: contain; + cursor: pointer; + opacity: 0.6; + transition: opacity 0.2s; +} + +.delete-icon:hover { + opacity: 1; + background-color: #f0f0f0; + border-radius: 3px; +} + +.user-info { + font-size: 13px; + color: #333; + margin-left: 10px; + font-weight: normal; +} + +.logout-btn { + margin-left: 10px; + padding: 4px 10px; + font-size: 12px; + border: 1px solid #ccc; + background: #f9f9f9; + color: #333; + border-radius: 4px; + cursor: pointer; +} + +.logout-btn:hover { + background-color: #f0f0f0; + color: #d00; +} + +.user-menu { + position: absolute; + top: 18px !important; + right: 22px !important; +} + +.user-avatar { + cursor: pointer; + font-size: 18px; + padding: 4px; +} + +.user-dropdown { + position: absolute; + right: 0; + top: 30px; + background: white; + border: 1px solid #ccc; + box-shadow: 0 0 4px rgba(0,0,0,0.1); + padding: 6px 10px; + font-size: 13px; + width: 120px; + z-index: 99; +} + +.user-dropdown div { + padding: 6px 0; + cursor: pointer; +} + +.user-dropdown div:hover { + background-color: #f0f0f0; +} + +.open-tab-btn { + margin-left: 16px !important; + padding: 2px 10px; + background: #f8f8f8; + border: 1px solid #c9dafc; + color: #2560de; + border-radius: 4px; + font-size: 15px; + cursor: pointer; + vertical-align: middle; + transition: background 0.2s; +} + +.open-tab-btn:hover { + background: #eaf1fb; + color: #1e40af; +} diff --git a/styles/styles-es.css b/styles/styles-es.css new file mode 100644 index 0000000..41bb91d --- /dev/null +++ b/styles/styles-es.css @@ -0,0 +1,99 @@ +#results { + list-style: none; + padding: 0; + border-radius: 10px; + box-shadow: 0 2px 8px #cdd2fa2c; + border: 1px solid #e2e9f4; + background: #f8fbff; + padding: 16px 20px; +} + +#results li { + margin-bottom: 14px; + border-bottom: 1px solid #ddd; + padding-bottom: 10px; +} + +#results a { + font-weight: bold; + color: #007bff; + text-decoration: none; + font-size: 15px; +} + +#results a:hover { + text-decoration: underline; +} + +#results .summary { + font-size: 13px; + color: #444; + margin-top: 4px; +} + +.pagination { + margin-top: 15px; + display: flex; + justify-content: center; + gap: 10px; +} + +.pagination button { + padding: 6px 12px; + font-size: 13px; + background-color: #eee; + border: 1px solid #ccc; + border-radius: 3px; + cursor: pointer; +} + +.pagination button:hover { + background-color: #ddd; +} + +#clearHistoryBtn { + background: #f8f8f8; + border: 1px solid #ccc; + border-radius: 4px; + font-size: 14px; + padding: 2px 8px; + cursor: pointer; + line-height: 20px; + height: 32px; +} + +#clearHistoryBtn:hover { + background-color: #eee; +} + +.history-wrapper { + margin-bottom: 10px; +} + +.history-header { + display: flex; + justify-content: space-between; + align-items: center; + font-size: 13px; + margin-bottom: 6px; +} + +.tag-history { + display: flex; + flex-wrap: wrap; + gap: 8px; + margin-bottom: 15px; +} + +.tag-history .tag { + background-color: #f0f0f0; + color: #333; + padding: 4px 10px; + border-radius: 12px; + font-size: 12px; + cursor: pointer; +} + +.tag-history .tag:hover { + background-color: #dcdcdc; +} diff --git a/styles/styles-llm.css b/styles/styles-llm.css new file mode 100644 index 0000000..f1ea058 --- /dev/null +++ b/styles/styles-llm.css @@ -0,0 +1,158 @@ +.llm-result-container { + margin-bottom: 14px; + max-height: 300px; + min-height: 60px; + overflow: auto; + border: 1px solid #e0e9f4; + border-radius: 10px; + padding: 16px 20px; + background: #f8fbff; + display: flex; + flex-direction: column; + resize: vertical; + box-shadow: 0 2px 8px #cdd2fa2c; +} + +.llm-title { + position: sticky; + top: 0; + background: #f8fbff; + font-weight: bold; + color: #2453b5; + margin: 0 -12px 8px -12px; + padding: 8px 12px 6px 12px; + font-size: 14px; + border-bottom: 1px solid #e0e9f4; + z-index: 2; +} + +.llm-result-content { + flex: 1; + overflow-y: auto; + min-height: 44px; + font-size: 14px; + color: #233; + line-height: 1.7; + word-break: break-all; + white-space: pre-wrap; + padding-left: 4px; + padding-right: 4px; +} + +.llm-input-bar { + display: flex; + gap: 8px; + margin-top: 8px; + padding-bottom: 2px; + align-items: center; +} + +#llmInput { + flex: 1; + padding: 6px 10px; + border: 1px solid #c9dafc; + border-radius: 5px; + font-size: 14px; + outline: none; +} + +#llmSendBtn { + padding: 6px 14px; + background: #4179f6; + color: #fff; + border: none; + border-radius: 5px; + cursor: pointer; + font-size: 14px; + transition: background 0.2s; +} + +#llmSendBtn:hover { + background: #2350b8; +} + +.llm-msg-item.llm-assistant { + color: #233; + background: #e7eefb; + border-radius: 5px; + margin: 3px 0 9px 0; + padding: 7px 8px; + word-break: break-all; + font-weight: 500; + border: 1px solid #b3cdfb; +} + +.assistant-label { + color: #2560de; + font-weight: bold; + margin-right: 3px; +} + +.llm-think { + background: #fffbe6; + color: #8d7a24; + font-size: 13px; + font-style: italic; + border-left: 3px solid #ffe16a; + border-radius: 5px; + margin-bottom: 6px; + padding: 7px 10px 7px 12px; + white-space: pre-wrap; +} + +.tab-bar { + display: flex; + margin-bottom: 12px; + border-bottom: 1.5px solid #e2e7f4; + background: #f8fbff; +} + +.tab-btn { + flex: 1; + padding: 9px 0; + border: none; + background: #f7faff; + color: #2764bb; + font-weight: bold; + cursor: pointer; + border-bottom: 2.5px solid transparent; + font-size: 15px; + transition: background 0.2s, border-color 0.2s; + border-radius: 12px 12px 0 0; + margin: 0 3px; +} + +.tab-btn.active { + background: #e7eefb; + color: #2050b0; + border-bottom: 2.5px solid #3070ed; +} + +.tab-content { + display: none; +} + +.tab-content.active { + display: block; +} + +body.fullscreen #tabContentAi .llm-result-container { + resize: vertical; + overflow: auto; + min-height: 160px; + max-height: 80vh; +} + +#tabContentAi .llm-result-container, +#tabContentEs { + margin-top: 8px; + margin-bottom: 8px; +} + +body.fullscreen #tabContentAi.tab-content.active { + flex: 1 1 0; + min-height: 0; + display: flex !important; + flex-direction: column; + height: 100%; +}