mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-16 20:07:49 +01:00
Migrate to python logging module with env var control.
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
import re
|
||||
import logging
|
||||
from typing import List
|
||||
|
||||
from config import CHROMA_CLIENT
|
||||
from config import SRC_LOG_LEVELS, CHROMA_CLIENT
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
log.setLevel(SRC_LOG_LEVELS["RAG"])
|
||||
|
||||
|
||||
def query_doc(collection_name: str, query: str, k: int, embedding_function):
|
||||
@@ -97,7 +101,7 @@ def rag_template(template: str, context: str, query: str):
|
||||
|
||||
|
||||
def rag_messages(docs, messages, template, k, embedding_function):
|
||||
print(docs)
|
||||
log.debug(f"docs: {docs}")
|
||||
|
||||
last_user_message_idx = None
|
||||
for i in range(len(messages) - 1, -1, -1):
|
||||
@@ -145,7 +149,7 @@ def rag_messages(docs, messages, template, k, embedding_function):
|
||||
embedding_function=embedding_function,
|
||||
)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
log.exception(e)
|
||||
context = None
|
||||
|
||||
relevant_contexts.append(context)
|
||||
|
||||
Reference in New Issue
Block a user