kb_create fail

This commit is contained in:
2025-11-07 11:48:05 +08:00
parent 54532747d2
commit b993d162c9
3 changed files with 19 additions and 15 deletions

View File

@@ -26,11 +26,12 @@ class CreateKnowledgeBaseRequest(BaseModel):
- parse_type=2: 使用自定义 pipeline需要 pipeline_idparser_id 为空
"""
name: str
parse_type: Literal[1, 2] = Field(..., description="解析类型1=内置解析器2=自定义pipeline")
parse_type: Literal[1, 2] = Field(default=1, description="解析类型1=内置解析器2=自定义pipeline")
embd_id: str = Field(..., description="嵌入模型ID")
parser_id: Optional[str] = Field(default="", description="解析器IDparse_type=1时必需")
pipeline_id: Optional[str] = Field(default="", description="流水线IDparse_type=2时必需")
description: Optional[str] = None
permission: Optional[str] = Field(default="me", description="权限me|team")
pagerank: Optional[int] = None
@model_validator(mode='after')
@@ -41,8 +42,9 @@ class CreateKnowledgeBaseRequest(BaseModel):
parser_id_val = self.parser_id or ""
pipeline_id_val = self.pipeline_id or ""
# 如果 parser_id 为空,自动设置为 "naive"
if parser_id_val.strip() == "":
raise ValueError("parse_type=1时parser_id不能为空")
self.parser_id = "naive"
if pipeline_id_val.strip() != "":
raise ValueError("parse_type=1时pipeline_id必须为空")
elif self.parse_type == 2:

View File

@@ -3,7 +3,7 @@
# - `elasticsearch` (default)
# - `infinity` (https://github.com/infiniflow/infinity)
# - `opensearch` (https://github.com/opensearch-project/OpenSearch)
DOC_ENGINE=elasticsearch
DOC_ENGINE=opensearch
# ------------------------------
# docker env var for specifying vector db type at startup

View File

@@ -1,34 +1,36 @@
services:
es01:
container_name: ragflow-es-01
opensearch01:
container_name: ragflow-opensearch-01
profiles:
- elasticsearch
image: elasticsearch:${STACK_VERSION}
- opensearch
image: hub.icert.top/opensearchproject/opensearch:2.19.1
volumes:
- esdata01:/usr/share/elasticsearch/data
- osdata01:/usr/share/opensearch/data
ports:
- ${ES_PORT}:9200
- ${OS_PORT}:9201
env_file: .env
environment:
- node.name=es01
- ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
- node.name=opensearch01
- OPENSEARCH_PASSWORD=${OPENSEARCH_PASSWORD}
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OPENSEARCH_PASSWORD}
- bootstrap.memory_lock=false
- discovery.type=single-node
- xpack.security.enabled=true
- xpack.security.http.ssl.enabled=false
- xpack.security.transport.ssl.enabled=false
- plugins.security.disabled=false
- plugins.security.ssl.http.enabled=false
- plugins.security.ssl.transport.enabled=true
- cluster.routing.allocation.disk.watermark.low=5gb
- cluster.routing.allocation.disk.watermark.high=3gb
- cluster.routing.allocation.disk.watermark.flood_stage=2gb
- TZ=${TIMEZONE}
- http.port=9201
mem_limit: ${MEM_LIMIT}
ulimits:
memlock:
soft: -1
hard: -1
healthcheck:
test: ["CMD-SHELL", "curl http://localhost:9200"]
test: ["CMD-SHELL", "curl http://localhost:9201"]
interval: 10s
timeout: 10s
retries: 120