Spaces:
Sleeping
Sleeping
Update app.py
Browse files129 unmodified lines13013113213313413513628 unmodified lines16516616716816917026 unmodified lines197198199200201202129 unmodified linesGenerates streaming chat responses, optionally with background web search."""cancel_event.clear()history = list(chat_history or [])history.append({'role': 'user', 'content': user_msg})# Launch web search if enabled28 unmodified linespipe = load_pipeline(model_name)prompt = format_conversation(history, enriched, pipe["tokenizer"])prompt_debug = f"\n\n--- Prompt Preview ---\n```\n{prompt}\n```"streamer = TextIterStreamer(pipe["tokenizer"],skip_prompt=True,26 unmodified linesbreaktext = chunk# Detect start of thinkingif not in_thought and '<think>' in text:in_thought = True129 unmodified lines13013113213313413513628 unmodified lines16516616716816917017117217317417526 unmodified lines202203204205206207208209210129 unmodified linesGenerates streaming chat responses, optionally with background web search."""cancel_event.clear()history = list(chat_history) if chat_history else []history.append({'role': 'user', 'content': user_msg})# Launch web search if enabled28 unmodified linespipe = load_pipeline(model_name)prompt = format_conversation(history, enriched, pipe["tokenizer"])# TODO:debug += "\nPROMPT:\n" + textprompt_debug = f"\n\n--- Prompt Preview ---\n```\n{prompt}\n```"streamer = TextIterStreamer(pipe["tokenizer"],skip_prompt=True,26 unmodified linesbreaktext = chunk# TODO:debug += "\nRESPONSE:\n" + text# Detect start of thinkingif not in_thought and '<think>' in text:in_thought = True
app.py+9-1