Skip to content

Commit be36d21

Browse files
committed
fixed error of logs not printing out
1 parent f50735b commit be36d21

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/any_chatbot/agent.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import argparse
2-
import random
32
import sqlite3
3+
import logging
44
from pathlib import Path
55

66
from langgraph.prebuilt import create_react_agent
@@ -12,6 +12,8 @@
1212
from any_chatbot.prompts import system_message
1313
from any_chatbot.utils import load_environ_vars
1414

15+
logger = logging.getLogger(__name__)
16+
1517
BASE = Path(__file__).parent.parent.parent
1618

1719

@@ -22,7 +24,7 @@ def parse_args() -> argparse.Namespace:
2224
"--ask",
2325
type=str,
2426
default=(
25-
"What kinds (text docs, images, or excel sheets) are available in the documents I have provided to you?\n\n"
27+
"What kinds (text docs, images, or excel/CSV sheets) are available in the documents I have provided to you?\n\n"
2628
),
2729
help="Your input prompt to the agent.",
2830
)
@@ -34,7 +36,7 @@ def parse_args() -> argparse.Namespace:
3436
p.add_argument(
3537
"--thread_id",
3638
type=str,
37-
default=str(random.random()),
39+
default="thread123",
3840
help="Your conversation history ID. Different IDs save different chat histories with agent.",
3941
)
4042
p.add_argument(
@@ -53,6 +55,7 @@ def parse_args() -> argparse.Namespace:
5355

5456

5557
def main() -> None:
58+
logging.basicConfig(level=logging.INFO)
5659
cfg = parse_args()
5760
load_environ_vars()
5861
# INDEXING

src/any_chatbot/indexing.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def load_and_split_text_docs(data_dir):
4141
glob=globs,
4242
loader_cls=UnstructuredFileLoader,
4343
)
44-
logger.info(f"Loading text files from {data_dir}")
44+
logger.info("Loading text files...")
4545
docs = loader.load()
4646
logger.info(f"Loaded {len(docs)} text files")
4747
# split
@@ -79,7 +79,7 @@ def load_image_docs_as_text(data_dir):
7979
glob=globs,
8080
loader_cls=UnstructuredFileLoader,
8181
)
82-
logger.info(f"Loading images from {data_dir}")
82+
logger.info("Loading images' OCR texts...")
8383
image_text_docs = loader.load()
8484
logger.info(f"Loaded {len(image_text_docs)} image files")
8585
# tag
@@ -107,7 +107,8 @@ def build_duckdb_and_summary_cards(
107107
if not any(next(data_dir.rglob(p), None) for p in patterns):
108108
logger.info(f"No CSV or Excel files found under {data_dir}; skipping.")
109109
return summary_cards
110-
logger.info(f"Detected CSV or Excel files under {data_dir}")
110+
logger.info(f"Detected CSV/Excel files under {data_dir}")
111+
logger.info("Loading CSV/Excel files...")
111112
# ensure the DB folder exists
112113
os.makedirs(db_path.parent, exist_ok=True)
113114
# empty the entire DB

0 commit comments

Comments
 (0)