kgrag/config.py
2026-07-29 18:10:19 +08:00

92 lines
3.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# app/model_config.py
import os
# ==================== 大模型配置 ====================
LLM_CONFIG = {
"model": "46-qwen3.6-35B",
"base_url": "http://192.168.2.12:59800/v1",
"api_key": "gpustack_dee9ca823290886c_5edfc86aeeeceb1e9ee5162941cb2cb5",
"temperature": 0.1,
"max_tokens": 25096,
"timeout": 30
}
# ==================== 嵌入模型配置 ====================
EMBEDDING_CONFIG = {
"model": "bge-m3",
"base_url": "http://192.168.2.12:59700/v1/embeddings",
"api_key": "gpustack_dee9ca823290886c_5edfc86aeeeceb1e9ee5162941cb2cb5",
}
# ==================== Neo4j 图数据库配置 ====================
NEO4J_CONFIG = {
# 优先读取环境变量,如果没有则使用默认值
# 注意:本地开发通常用 localhost部署时用服务名 neo4j
"uri": "neo4j://192.168.2.12:57687",
"username": "neo4j",
"password": "zdht123@",
"database": "neo4j", # 新增 database 配置
}
# ==================== 检索与索引配置 ====================
SEARCH_CONFIG = {
"name_property": "名称",
"fulltext_property": "fulltext",
"embedding_property": "embedding",
"search_label": "Searchable",
"vector_index_name": "global_searchable_embedding",
"fulltext_index_name": "global_searchable_content_search",
"fulltext_field_index_name": "global_searchable_fulltext_search",
"global_entity_embedding" : "global_entity_embedding",
"global_entity_content_search": "global_entity_content_search",
"excluded_business_labels": [
"Entity", "Chunk", "Document", "_Bloom_Perspective_", "Searchable"
],
"vector_dimension": 1024,
"jieba_pos_whitelist": ["n", "nr", "ns", "nt", "nz", "vn", "eng"],
"embed_batch_size" : 64,
"embed_thread_num" : 4,
"node_fetch_page" : 10000,
}
INDEXING_ULR = "http://192.168.2.12:59085/neo4j_indexing"
URL = {
"indexing_url" : "http://192.168.2.12:59085/neo4j_indexing",
"prefix_url" : "http://192.168.2.12:59085",
}
API_URLS = [
"http://192.168.2.12:59988/analyze-pdf",
# "http://192.168.0.111:9977/analyze-pdf",
# "http://192.168.0.111:9978/analyze-pdf",
#"http://192.168.0.111:9979/analyze-pdf",
#"http://192.168.0.111:9980/analyze-pdf",
# "http://192.168.0.111:9975/analyze-pdf",
]
API_OTHER_URLS = [
"http://192.168.2.12:59988/analyze-otherfile",
# "http://192.168.0.111:9977/analyze-otherfile",
# "http://192.168.0.111:9978/analyze-otherfile",
#"http://192.168.0.111:9979/analyze-otherfile",
#"http://192.168.0.111:9980/analyze-otherfile",
# "http://192.168.0.111:9975/analyze-otherfile",
]
# ==================== 切片图片处理配置 ====================
MAX_SPLIT_IMAGE_INPUT_BYTES = 50 * 1024 * 1024
MAX_SPLIT_IMAGE_BYTES = 10 * 1024 * 1024
MAX_SPLIT_IMAGE_BASE64_CHARS = (MAX_SPLIT_IMAGE_INPUT_BYTES * 4 // 3) + 4096
SPLIT_IMAGE_COMPRESS_THRESHOLD_BYTES = MAX_SPLIT_IMAGE_BYTES
SPLIT_IMAGE_MAX_DIMENSION = 4096
SPLIT_IMAGE_JPEG_QUALITY = 88
OCR_CONCURRENCY = 1
VLM_CONCURRENCY = 2
SHIP_MODEL_NAME = "/app/ship_xinghao.json"
TREE_JSON_PATH = "/app/tree_data.json"
# ==================== mineru和kgrag目录映射地址 ====================
SEARCH_DIR ="/app/mineru_output"
IMAGE_DIR = "/app/mineru_output/images"