..
This commit is contained in:
+35
-1
@@ -321,6 +321,34 @@ async def get_config():
|
||||
"available_models": list(model_service.AVAILABLE_MODELS.keys())
|
||||
}
|
||||
|
||||
@app.get("/test-webhook")
|
||||
async def test_webhook():
|
||||
"""
|
||||
Test the webhook registration.
|
||||
|
||||
Returns:
|
||||
Webhook registration status.
|
||||
"""
|
||||
# Get the public URL of this service
|
||||
service_url = f"http://{config.API_HOST}:{config.API_PORT}"
|
||||
if config.PUBLIC_URL:
|
||||
service_url = config.PUBLIC_URL
|
||||
|
||||
# Webhook URL
|
||||
webhook_url = f"{service_url}/webhooks/channel-message"
|
||||
|
||||
# Try to register the webhook again
|
||||
success = openwebui_channels.register_webhook(webhook_url)
|
||||
|
||||
# Get all registered webhooks
|
||||
webhooks = openwebui_channels.get_webhooks()
|
||||
|
||||
return {
|
||||
"webhook_url": webhook_url,
|
||||
"registration_success": success,
|
||||
"registered_webhooks": webhooks
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Model endpoints
|
||||
@@ -586,7 +614,13 @@ async def channel_message_webhook(request: ChannelMessageWebhook):
|
||||
Processing status.
|
||||
"""
|
||||
try:
|
||||
print(f"Received channel message webhook: {request.channel_id}, {request.user_id}, {request.message}")
|
||||
print("=" * 50)
|
||||
print("WEBHOOK RECEIVED")
|
||||
print(f"Channel ID: {request.channel_id}")
|
||||
print(f"User ID: {request.user_id}")
|
||||
print(f"Message: {request.message}")
|
||||
print(f"Timestamp: {request.timestamp}")
|
||||
print("=" * 50)
|
||||
|
||||
# Find the chat associated with this OpenWebUI channel
|
||||
chat_id = None
|
||||
|
||||
Reference in New Issue
Block a user