mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-05 03:18:51 +00:00
refine log format (#312)
### What problem does this PR solve? Issue link:#264 ### Type of change - [x] Documentation Update - [x] Refactoring
This commit is contained in:
parent
0b2808f990
commit
f6c7204002
@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
- CPU >= 2 cores
|
- CPU >= 2 cores
|
||||||
- RAM >= 8 GB
|
- RAM >= 8 GB
|
||||||
- Docker >= 24.0.0
|
- Docker >= 24.0.0 & Docker Compose >= v2.26.1
|
||||||
> If you have not installed Docker on your local machine (Windows, Mac, or Linux), see [Install Docker Engine](https://docs.docker.com/engine/install/).
|
> If you have not installed Docker on your local machine (Windows, Mac, or Linux), see [Install Docker Engine](https://docs.docker.com/engine/install/).
|
||||||
|
|
||||||
### 🚀 Start up the server
|
### 🚀 Start up the server
|
||||||
|
|||||||
@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
- CPU >= 2 cores
|
- CPU >= 2 cores
|
||||||
- RAM >= 8 GB
|
- RAM >= 8 GB
|
||||||
- Docker >= 24.0.0
|
- Docker >= 24.0.0 & Docker Compose >= v2.26.1
|
||||||
> ローカルマシン(Windows、Mac、または Linux)に Docker をインストールしていない場合は、[Docker Engine のインストール](https://docs.docker.com/engine/install/) を参照してください。
|
> ローカルマシン(Windows、Mac、または Linux)に Docker をインストールしていない場合は、[Docker Engine のインストール](https://docs.docker.com/engine/install/) を参照してください。
|
||||||
|
|
||||||
### 🚀 サーバーを起動
|
### 🚀 サーバーを起動
|
||||||
|
|||||||
@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
- CPU >= 2 核
|
- CPU >= 2 核
|
||||||
- RAM >= 8 GB
|
- RAM >= 8 GB
|
||||||
- Docker >= 24.0.0
|
- Docker >= 24.0.0 & Docker Compose >= v2.26.1
|
||||||
> 如果你并没有在本机安装 Docker(Windows、Mac,或者 Linux), 可以参考文档 [Install Docker Engine](https://docs.docker.com/engine/install/) 自行安装。
|
> 如果你并没有在本机安装 Docker(Windows、Mac,或者 Linux), 可以参考文档 [Install Docker Engine](https://docs.docker.com/engine/install/) 自行安装。
|
||||||
|
|
||||||
### 🚀 启动服务器
|
### 🚀 启动服务器
|
||||||
|
|||||||
@ -695,7 +695,7 @@ class Dialog(DataBaseModel):
|
|||||||
language = CharField(
|
language = CharField(
|
||||||
max_length=32,
|
max_length=32,
|
||||||
null=True,
|
null=True,
|
||||||
default="English",
|
default="Chinese",
|
||||||
help_text="English|Chinese")
|
help_text="English|Chinese")
|
||||||
llm_id = CharField(max_length=32, null=False, help_text="default llm ID")
|
llm_id = CharField(max_length=32, null=False, help_text="default llm ID")
|
||||||
llm_setting = JSONField(null=False, default={"temperature": 0.1, "top_p": 0.3, "frequency_penalty": 0.7,
|
llm_setting = JSONField(null=False, default={"temperature": 0.1, "top_p": 0.3, "frequency_penalty": 0.7,
|
||||||
|
|||||||
@ -13,15 +13,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
import logging
|
|
||||||
|
|
||||||
from rag.utils import ELASTICSEARCH
|
|
||||||
from rag.nlp import search
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from enum import IntEnum, Enum
|
from enum import IntEnum, Enum
|
||||||
|
|
||||||
from api.utils import get_base_config, decrypt_database_config
|
|
||||||
from api.utils.file_utils import get_project_base_directory
|
from api.utils.file_utils import get_project_base_directory
|
||||||
from api.utils.log_utils import LoggerFactory, getLogger
|
from api.utils.log_utils import LoggerFactory, getLogger
|
||||||
|
|
||||||
@ -32,13 +25,16 @@ LoggerFactory.set_directory(
|
|||||||
"logs",
|
"logs",
|
||||||
"api"))
|
"api"))
|
||||||
# {CRITICAL: 50, FATAL:50, ERROR:40, WARNING:30, WARN:30, INFO:20, DEBUG:10, NOTSET:0}
|
# {CRITICAL: 50, FATAL:50, ERROR:40, WARNING:30, WARN:30, INFO:20, DEBUG:10, NOTSET:0}
|
||||||
LoggerFactory.LEVEL = 10
|
LoggerFactory.LEVEL = 30
|
||||||
|
|
||||||
stat_logger = getLogger("stat")
|
stat_logger = getLogger("stat")
|
||||||
access_logger = getLogger("access")
|
access_logger = getLogger("access")
|
||||||
database_logger = getLogger("database")
|
database_logger = getLogger("database")
|
||||||
chat_logger = getLogger("chat")
|
chat_logger = getLogger("chat")
|
||||||
database_logger.setLevel(logging.WARNING)
|
|
||||||
|
from rag.utils import ELASTICSEARCH
|
||||||
|
from rag.nlp import search
|
||||||
|
from api.utils import get_base_config, decrypt_database_config
|
||||||
|
|
||||||
API_VERSION = "v1"
|
API_VERSION = "v1"
|
||||||
RAG_FLOW_SERVICE_NAME = "ragflow"
|
RAG_FLOW_SERVICE_NAME = "ragflow"
|
||||||
@ -79,7 +75,7 @@ default_llm = {
|
|||||||
"image2text_model": "glm-4v",
|
"image2text_model": "glm-4v",
|
||||||
"asr_model": "",
|
"asr_model": "",
|
||||||
},
|
},
|
||||||
"Local": {
|
"Ollama": {
|
||||||
"chat_model": "qwen-14B-chat",
|
"chat_model": "qwen-14B-chat",
|
||||||
"embedding_model": "flag-embedding",
|
"embedding_model": "flag-embedding",
|
||||||
"image2text_model": "",
|
"image2text_model": "",
|
||||||
|
|||||||
@ -26,7 +26,8 @@ from api.utils import file_utils
|
|||||||
|
|
||||||
class LoggerFactory(object):
|
class LoggerFactory(object):
|
||||||
TYPE = "FILE"
|
TYPE = "FILE"
|
||||||
LOG_FORMAT = "[%(levelname)s] [%(asctime)s] [jobId] [%(process)s:%(thread)s] - [%(module)s.%(funcName)s] [line:%(lineno)d]: %(message)s"
|
LOG_FORMAT = "[%(levelname)s] [%(asctime)s] [%(module)s.%(funcName)s] [line:%(lineno)d]: %(message)s"
|
||||||
|
logging.basicConfig(format=LOG_FORMAT)
|
||||||
LEVEL = logging.DEBUG
|
LEVEL = logging.DEBUG
|
||||||
logger_dict = {}
|
logger_dict = {}
|
||||||
global_handler_dict = {}
|
global_handler_dict = {}
|
||||||
|
|||||||
@ -110,7 +110,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000,
|
|||||||
[t for t in random_choices([t for t, _ in sections], k=100)])
|
[t for t in random_choices([t for t, _ in sections], k=100)])
|
||||||
if bull >= 0:
|
if bull >= 0:
|
||||||
chunks = ["\n".join(ck)
|
chunks = ["\n".join(ck)
|
||||||
for ck in hierarchical_merge(bull, sections, 3)]
|
for ck in hierarchical_merge(bull, sections, 5)]
|
||||||
else:
|
else:
|
||||||
sections = [s.split("@") for s, _ in sections]
|
sections = [s.split("@") for s, _ in sections]
|
||||||
sections = [(pr[0], "@" + pr[1]) for pr in sections if len(pr) == 2]
|
sections = [(pr[0], "@" + pr[1]) for pr in sections if len(pr) == 2]
|
||||||
|
|||||||
@ -133,7 +133,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000,
|
|||||||
|
|
||||||
make_colon_as_title(sections)
|
make_colon_as_title(sections)
|
||||||
bull = bullets_category(sections)
|
bull = bullets_category(sections)
|
||||||
chunks = hierarchical_merge(bull, sections, 3)
|
chunks = hierarchical_merge(bull, sections, 5)
|
||||||
if not chunks:
|
if not chunks:
|
||||||
callback(0.99, "No chunk parsed out.")
|
callback(0.99, "No chunk parsed out.")
|
||||||
|
|
||||||
|
|||||||
@ -98,7 +98,7 @@ class QWenChat(Base):
|
|||||||
tk_count = 0
|
tk_count = 0
|
||||||
if response.status_code == HTTPStatus.OK:
|
if response.status_code == HTTPStatus.OK:
|
||||||
ans += response.output.choices[0]['message']['content']
|
ans += response.output.choices[0]['message']['content']
|
||||||
tk_count += response.usage.output_tokens
|
tk_count += response.usage.total_tokens
|
||||||
if response.output.choices[0].get("finish_reason", "") == "length":
|
if response.output.choices[0].get("finish_reason", "") == "length":
|
||||||
ans += "...\nFor the content length reason, it stopped, continue?" if is_english(
|
ans += "...\nFor the content length reason, it stopped, continue?" if is_english(
|
||||||
[ans]) else "······\n由于长度的原因,回答被截断了,要继续吗?"
|
[ans]) else "······\n由于长度的原因,回答被截断了,要继续吗?"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user