update message flow
Browse filesFiles changed (3)
37 unmodified lines383940414243444537 unmodified lineslog_level: str = os.getenv("LOG_LEVEL", "DEBUG") or "DEBUG"# Search Configurationmatch_count: int = int(os.getenv("MATCH_COUNT", "15")) or 15max_docs_to_rerank: int = int(os.getenv("MAX_DOCS_TO_RERANK", "15")) or 15# Gemini Configuration# Hỗ trợ nhiều API key và model cho Gemini37 unmodified lines383940414243444537 unmodified lineslog_level: str = os.getenv("LOG_LEVEL", "DEBUG") or "DEBUG"# Search Configurationmatch_count: int = int(os.getenv("MATCH_COUNT", "20")) or 20max_docs_to_rerank: int = int(os.getenv("MAX_DOCS_TO_RERANK", "20")) or 20# Gemini Configuration# Hỗ trợ nhiều API key và model cho Gemini
394 unmodified lines395396397398399400401402394 unmodified lineslogger.info(f"[DEBUG] tạo embedding: {action}")embedding = await self.channel.embedder.create_embedding(action)logger.info(f"[DEBUG] embedding: {embedding[:5]} ... (total {len(embedding)})")matches = self.channel.supabase.match_documents(embedding,# vehicle_keywords=keywords,user_question=action)394 unmodified lines395396397398399400401402403404405406394 unmodified lineslogger.info(f"[DEBUG] tạo embedding: {action}")embedding = await self.channel.embedder.create_embedding(action)logger.info(f"[DEBUG] embedding: {embedding[:5]} ... (total {len(embedding)})")# Lấy match_count từ configfrom app.config import get_settingsmatch_count = get_settings().match_countmatches = self.channel.supabase.match_documents(embedding,match_count=match_count,# vehicle_keywords=keywords,user_question=action)
100 unmodified lines101102103104105106107108109100 unmodified lines# Không giới hạn content length, giữ nguyên nội dung luậtdocs_content = []for i, doc in enumerate(docs):tieude = (doc.get('tieude') or '').strip()noidung = (doc.get('noidung') or '').strip()content = f"{tieude} {noidung}".strip()docs_content.append(f"{i+1}. {content}")batch_prompt = (100 unmodified lines101102103104105106107108109110100 unmodified lines# Không giới hạn content length, giữ nguyên nội dung luậtdocs_content = []for i, doc in enumerate(docs):# tieude = (doc.get('tieude') or '').strip()# noidung = (doc.get('noidung') or '').strip()# content = f"{tieude} {noidung}".strip()content = (doc.get('fullcontent') or '').strip()docs_content.append(f"{i+1}. {content}")batch_prompt = (
app/config.py+2-2
app/message_processor.py+4
app/reranker.py+4-3