diff --git a/src/config/__init__.py b/src/config/__init__.py index b98038c4..50ae6ce7 100644 --- a/src/config/__init__.py +++ b/src/config/__init__.py @@ -38,12 +38,12 @@ class Config(SimpleConfig): ### >>> 默认配置 # 可以在 config/base.yaml 中覆盖 - self.add_item("mode", default="cli", des="运行模式", choices=["cli", "api"]) self.add_item("stream", default=True, des="是否开启流式输出") self.add_item("save_dir", default="saves", des="保存目录") # 功能选项 self.add_item("enable_reranker", default=False, des="是否开启重排序") self.add_item("enable_knowledge_base", default=False, des="是否开启知识库") + self.add_item("enable_knowledge_graph", default=False, des="是否开启知识图谱") self.add_item("enable_search_engine", default=False, des="是否开启搜索引擎") # 模型配置 @@ -70,6 +70,13 @@ class Config(SimpleConfig): "choices": choices } + def __dict__(self): + blocklist = [ + "_config_items", + "model_names", + ] + return {k: v for k, v in self.items() if k not in blocklist} + def handle_self(self): ### handle local model model_root_dir = os.getenv("MODEL_ROOT_DIR", "pretrained_models") @@ -98,7 +105,6 @@ class Config(SimpleConfig): content = f.read() if content: local_config = json.loads(content) - local_config.pop("_config_items") self.update(local_config) else: print(f"{self.filename} is empty.") @@ -108,7 +114,6 @@ class Config(SimpleConfig): content = f.read() if content: local_config = yaml.safe_load(content) - local_config.pop("_config_items") self.update(local_config) else: print(f"{self.filename} is empty.") diff --git a/web/src/assets/main.css b/web/src/assets/main.css index 8dd4cc93..238be927 100644 --- a/web/src/assets/main.css +++ b/web/src/assets/main.css @@ -7,7 +7,8 @@ /* layout */ .layout-container { - padding: 10px 30px; + width: 100%; + padding: 16px 30px; background-color: #FCFEFF; h2 { diff --git a/web/src/components/ChatComponent.vue b/web/src/components/ChatComponent.vue index 81db3604..37374d1a 100644 --- a/web/src/components/ChatComponent.vue +++ b/web/src/components/ChatComponent.vue @@ -329,6 +329,7 @@ const updateStatus = (id, status) => { return acc; }, {}) } + scrollToBottom() } const simpleCall = (message) => { @@ -573,7 +574,7 @@ watch( max-width: 900px; margin: 0 auto; flex-grow: 1; - padding: 1rem; + padding: 1rem 2rem; display: flex; flex-direction: column; diff --git a/web/src/components/RefsComponent.vue b/web/src/components/RefsComponent.vue index 1223053f..40249865 100644 --- a/web/src/components/RefsComponent.vue +++ b/web/src/components/RefsComponent.vue @@ -28,13 +28,13 @@

相似度距离:

- +

-

+

重排序分数:

- +

@@ -74,7 +74,6 @@ const showRefs = computed(() => message.value.role=='received' && message.value. .item { background: var(--main-10); color: var(--main-600); - border: 1px solid var(--main-50); padding: 2px 8px; border-radius: 8px; font-size: 14px; diff --git a/web/src/views/DataBaseInfoView.vue b/web/src/views/DataBaseInfoView.vue index 1f6e6658..22c4d85c 100644 --- a/web/src/views/DataBaseInfoView.vue +++ b/web/src/views/DataBaseInfoView.vue @@ -18,14 +18,6 @@ {{ database.embed_model }} -
-
- 添加文件 -
-
- 检索测试 -
-

参数配置

@@ -46,103 +38,113 @@
-
-

向知识库中添加文件

-
- -

点击或者把文件拖拽到这里上传

-

- 目前仅支持上传文本文件,如 .pdf, .txt, .md。且同名文件无法重复添加。 -

-
-
- - 添加到知识库 - - 刷新状态 - - - - -

共 {{ selectedFile?.lines.length }} 个片段

-

- Chunk #{{ line.id }} {{ line.text }} -

-
-
-
-

检索测试

-
- - - - 检索 - -
-
-
-

- #{{ idx + 1 }}    - {{ result.file.filename }}    - 距离:{{ result.distance.toFixed(4) }}    - 重排序:{{ result.rerank_score.toFixed(4) }} -

-

{{ result.entity.text }}

+ + + +
+

向知识库中添加文件

+
+ +

点击或者把文件拖拽到这里上传

+

+ 目前仅支持上传文本文件,如 .pdf, .txt, .md。且同名文件无法重复添加。 +

+
+
+ + 添加到知识库 + + 刷新状态 + + + + +

共 {{ selectedFile?.lines.length }} 个片段

+

+ Chunk #{{ line.id }} {{ line.text }} +

+
-
-
+ + + +
+

检索测试

+
+ + + + 检索 + + +
+
+
+

+ #{{ idx + 1 }}    + {{ result.file.filename }}    + 距离:{{ result.distance.toFixed(4) }}    + 重排序:{{ result.rerank_score.toFixed(4) }} +

+

{{ result.entity.text }}

+
+
+
+
+ +
@@ -160,6 +162,7 @@ import { DeleteOutlined, CloudUploadOutlined, SearchOutlined, + LoadingOutlined } from '@ant-design/icons-vue' @@ -490,38 +493,38 @@ onMounted(() => { } } - .pagebtns { - display: flex; - flex-direction: column; - gap: 16px; + // .pagebtns { + // display: flex; + // flex-direction: column; + // gap: 16px; - > div { - gap: 1rem; - width: 100%; - display: flex; - justify-content: center; - align-items: center; - padding: 10px 16px; - height: auto; - border-radius: 4px; - border: none; - background: var(--main-light-5); - letter-spacing: 4px; - border-radius: 8px; - border: 1px solid var(--main-light-2); + // > div { + // gap: 1rem; + // width: 100%; + // display: flex; + // justify-content: center; + // align-items: center; + // padding: 10px 16px; + // height: auto; + // border-radius: 4px; + // border: none; + // background: var(--main-light-5); + // letter-spacing: 4px; + // border-radius: 8px; + // border: 1px solid var(--main-light-2); - &:hover { - cursor: pointer; - background: var(--main-light-3); - } - } + // &:hover { + // cursor: pointer; + // background: var(--main-light-3); + // } + // } - .active { - color: var(--main-color); - background: var(--main-light-3); - font-weight: bold; - } - } + // .active { + // color: var(--main-color); + // background: var(--main-light-3); + // font-weight: bold; + // } + // } .query-params { display: flex; @@ -549,10 +552,13 @@ onMounted(() => { } } +.atab-container { + padding: 12px 16px; + width: 100%; +} + .db-info-container { - padding: 20px; flex: 1 1 auto; - overflow: scroll; .query-action { display: flex; @@ -564,13 +570,13 @@ onMounted(() => { border: 1px solid var(--main-light-2); } - button { + button.btn-query { height: auto; - width: 120px; + width: 100px; box-shadow: none; border: none; font-weight: bold; - background: var(--main-light-2); + background: var(--main-light-3); color: var(--main-color); &:disabled { @@ -627,6 +633,24 @@ onMounted(() => { margin: 0; } + h3 { + font-size: 20px; + font-weight: bold; + + &::after { + content: ''; + position: absolute; + bottom: 0px; + width: 100%; + height: 10px; + background: var(--main-color); + display: block; + opacity: 0.5; + z-index: -1; + + } + } + p { color: var(--c-text-light-1); font-size: small; diff --git a/web/src/views/GraphView.vue b/web/src/views/GraphView.vue index 13afc759..4e7320fc 100644 --- a/web/src/views/GraphView.vue +++ b/web/src/views/GraphView.vue @@ -1,5 +1,5 @@