chore: remove all WildFiles references, use documents provider
- Remove WILDFILES_BASE_URL and WILDFILES_ORG env vars - Rename _wildfiles_org_cache to _documents_cache - Update _has_documents() to use provider=documents - Remove "wildfiles connect" command alias (keep "docs connect") - Remove WILDFILES env vars from docker-compose.yml Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
23
bot.py
23
bot.py
@@ -67,8 +67,6 @@ CREDS_FILE = os.path.join(STORE_PATH, "credentials.json")
|
||||
LITELLM_URL = os.environ.get("LITELLM_BASE_URL", "")
|
||||
LITELLM_KEY = os.environ.get("LITELLM_API_KEY", "not-needed")
|
||||
DEFAULT_MODEL = os.environ.get("DEFAULT_MODEL", "claude-sonnet")
|
||||
WILDFILES_BASE_URL = os.environ.get("WILDFILES_BASE_URL", "")
|
||||
WILDFILES_ORG = os.environ.get("WILDFILES_ORG", "")
|
||||
USER_KEYS_FILE = os.environ.get("USER_KEYS_FILE", "/data/user_keys.json")
|
||||
MEMORY_SERVICE_URL = os.environ.get("MEMORY_SERVICE_URL", "http://memory-service:8090")
|
||||
CONFLUENCE_URL = os.environ.get("CONFLUENCE_BASE_URL", "")
|
||||
@@ -878,7 +876,7 @@ class Bot:
|
||||
self.atlassian = AtlassianClient(PORTAL_URL, BOT_API_KEY)
|
||||
self.llm = AsyncOpenAI(base_url=LITELLM_URL, api_key=LITELLM_KEY) if LITELLM_URL else None
|
||||
self.user_keys: dict[str, str] = self._load_user_keys() # matrix_user_id -> api_key (legacy)
|
||||
self._wildfiles_org_cache: dict[str, str | None] = {} # matrix_user_id -> org_slug (from portal)
|
||||
self._documents_cache: dict[str, str | None] = {} # matrix_user_id -> connected status
|
||||
self.room_models: dict[str, str] = {} # room_id -> model name
|
||||
self.auto_rename_rooms: set[str] = set() # rooms with auto-rename enabled
|
||||
self._recent_images: dict[str, tuple[str, str, float]] = {} # room_id -> (b64, mime, timestamp)
|
||||
@@ -912,26 +910,26 @@ class Bot:
|
||||
|
||||
Results are cached per session.
|
||||
"""
|
||||
if matrix_user_id in self._wildfiles_org_cache:
|
||||
return self._wildfiles_org_cache[matrix_user_id] is not None
|
||||
if matrix_user_id in self._documents_cache:
|
||||
return self._documents_cache[matrix_user_id] is not None
|
||||
|
||||
if self.atlassian.enabled:
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=10.0) as client:
|
||||
resp = await client.get(
|
||||
f"{self.atlassian.portal_url}/api/bot/tokens",
|
||||
params={"matrix_user_id": matrix_user_id, "provider": "wildfiles"},
|
||||
params={"matrix_user_id": matrix_user_id, "provider": "documents"},
|
||||
headers={"Authorization": f"Bearer {self.atlassian.bot_api_key}"},
|
||||
)
|
||||
resp.raise_for_status()
|
||||
data = resp.json()
|
||||
if data.get("connected"):
|
||||
self._wildfiles_org_cache[matrix_user_id] = "connected"
|
||||
self._documents_cache[matrix_user_id] = "connected"
|
||||
return True
|
||||
except Exception:
|
||||
logger.debug("Portal document check failed for %s", matrix_user_id, exc_info=True)
|
||||
|
||||
self._wildfiles_org_cache[matrix_user_id] = None
|
||||
self._documents_cache[matrix_user_id] = None
|
||||
return False
|
||||
|
||||
async def start(self):
|
||||
@@ -1830,14 +1828,11 @@ class Bot:
|
||||
if cmd == "help":
|
||||
await self._send_text(room.room_id, HELP_TEXT)
|
||||
|
||||
elif cmd == "wildfiles connect" or cmd.startswith("wildfiles connect ") or cmd == "docs connect" or cmd.startswith("docs connect "):
|
||||
if cmd.startswith("docs connect"):
|
||||
api_key = cmd[12:].strip() if cmd.startswith("docs connect ") else ""
|
||||
else:
|
||||
api_key = cmd[18:].strip() if cmd.startswith("wildfiles connect ") else ""
|
||||
elif cmd == "docs connect" or cmd.startswith("docs connect "):
|
||||
api_key = cmd[12:].strip() if cmd.startswith("docs connect ") else ""
|
||||
await self._handle_connect(room, api_key, event)
|
||||
|
||||
elif cmd == "wildfiles disconnect" or cmd == "docs disconnect":
|
||||
elif cmd == "docs disconnect":
|
||||
await self._handle_disconnect(room, event)
|
||||
|
||||
elif cmd == "models":
|
||||
|
||||
Reference in New Issue
Block a user