"""Реестр провайдеров: имя -> (search, available, note).""" from . import cards, forums, reddit, searchers, treg, x MODULES = { "reddit": reddit, "x": x, "forums": forums, "tavily": searchers, "exa": searchers, "you": searchers, "firecrawl": searchers, "ddg": searchers, "mojeek": searchers, "bing": searchers, "cards": cards, "treg": treg, } # какой функцией звать внутри модуля FUNCS = { "reddit": "search_reddit", "x": "search_x", "forums": "search_forums", "tavily": "search_tavily", "exa": "search_exa", "you": "search_you", "firecrawl": "search_firecrawl", "ddg": "search_ddg", "mojeek": "search_mojeek", "bing": "search_bing", "cards": "extract_cards", "treg": "search_treg", } def get(name): mod = MODULES.get(name) if not mod: return None return getattr(mod, FUNCS[name], None) def status(): rows = [] for name, mod in MODULES.items(): fn = getattr(mod, "available", None) ok, note = fn(name) if callable(fn) else (True, "") rows.append((name, ok, note)) return rows