| 76 | } |
| 77 | |
| 78 | void ModelRunner::InteractiveChat() { |
| 79 | std::cout << "🚀 Starting interactive chat mode...\n"; |
| 80 | std::cout << "Commands: /help, /reset, /config, /exit\n"; |
| 81 | #ifdef LLM_SUPPORT_VISION |
| 82 | #ifndef OPENCV_NOT_AVAILABLE |
| 83 | std::cout << "💡 You can also use video prompts: <video>path/to/video.mp4</video>\n"; |
| 84 | #else |
| 85 | std::cout << "⚠️ Video processing is disabled (OpenCV not available)\n"; |
| 86 | #endif |
| 87 | #endif |
| 88 | std::cout << "\n"; |
| 89 | |
| 90 | while (true) { |
| 91 | std::cout << "👤 User: "; |
| 92 | std::string input; |
| 93 | if (!std::getline(std::cin, input)) { |
| 94 | std::cout << "\n"; |
| 95 | break; |
| 96 | } |
| 97 | |
| 98 | if (input == "/exit") break; |
| 99 | if (input == "/help") ShowChatHelp(); |
| 100 | else if (input == "/reset") ResetConversation(); |
| 101 | else if (input == "/config") ShowConfig(); |
| 102 | else if (!input.empty()) { |
| 103 | std::cout << "\n🤖 Assistant: " << std::flush; |
| 104 | // Use ProcessPrompt to handle both text and video prompts |
| 105 | ProcessPrompt(input, &std::cout); |
| 106 | std::cout << "\n"; |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | int ModelRunner::ProcessPrompt(const std::string& prompt, std::ostream* output, int max_new_tokens) { |
| 112 | if (output == nullptr) { |