Spaces:
Sleeping
Sleeping
| import helper | |
| from openrouter_chat import get_chat_completion | |
| def test_openrouter_connection(): | |
| print("Testing OpenRouter connection...") | |
| try: | |
| response = get_chat_completion([{"role": "user", "content": "Hello"}]) | |
| if response: | |
| print("β OpenRouter connection successful.") | |
| else: | |
| print("β OpenRouter connection failed (empty response).") | |
| except Exception as e: | |
| print(f"β OpenRouter connection failed: {e}") | |
| def test_title_generation(): | |
| print("\nTesting Title Generation from Messages...") | |
| messages = [ | |
| "Hey, are we still on for the movies tonight?", | |
| "Yeah, lets go watch that new sci-fi one.", | |
| "Cool, I'll buy the tickets online.", | |
| "Meet you at the cinema at 7?" | |
| ] | |
| topic_map = {0: messages} | |
| try: | |
| titles = helper.generate_topic_titles_from_messages(topic_map) | |
| title = titles.get(0) | |
| print(f"Generated Title: {title}") | |
| if title and title != "Topic 0": | |
| print("β Title generation successful.") | |
| else: | |
| print("β οΈ Title generation returned default or empty.") | |
| except Exception as e: | |
| print(f"β Title generation failed: {e}") | |
| if __name__ == "__main__": | |
| test_openrouter_connection() | |
| test_title_generation() | |