normalize
#37
by ismailhakki37 - opened
95 unmodified lines96979899100101102103104105106107108455 unmodified lines56456556656756856957057157257357457557657757857958058158295 unmodified linescontext_len = Noneargs = None
# Configuration for consistent responsesPROMPT_NORMALIZATION = True # Set to False to disable prompt normalizationDEFAULT_ECG_PROMPT = "What are the main features and diagnosis in this ECG image? Provide a comprehensive clinical analysis"
# Note: When PROMPT_NORMALIZATION is True, all ECG diagnosis requests will be# standardized to ensure consistent response lengths and content across different clients.
def get_conv_log_filename(): t = datetime.datetime.now() name = os.path.join(LOGDIR, f"{t.year}-{t.month:02d}-{t.day:02d}-user_conv.json")455 unmodified lines payload.get("prompt") or payload.get("istem") or "") # Normalize prompt to ensure consistent responses # This helps maintain consistency across different clients if PROMPT_NORMALIZATION and "ecg" in message_text.lower() and "diagnosis" in message_text.lower(): # Standardize ECG analysis prompts for consistency if "comprehensive" in message_text.lower(): message_text = DEFAULT_ECG_PROMPT elif "concise" in message_text.lower(): message_text = "What are the main features and diagnosis in this ECG image? Provide a concise, clinical answer." else: # Default to comprehensive analysis for consistency message_text = DEFAULT_ECG_PROMPT print(f"[DEBUG] Normalized prompt to: {message_text}") # Extract image with multiple possible keys image_input = (payload.get("image") or payload.get("image_url") or handler.py+20