✨ Features: - ALS file generator (creates Ableton Live projects) - ALS parser (reads and analyzes projects) - AI clients (GLM4.6 + Minimax M2) - Multiple music genres (House, Techno, Hip-Hop) - Complete documentation 🤖 Ready to generate music with AI!
110 lines
2.8 KiB
Python
110 lines
2.8 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test both AI APIs separately to verify they work
|
|
"""
|
|
|
|
import asyncio
|
|
import sys
|
|
sys.path.append('/home/ren/musia')
|
|
|
|
from src.backend.ai.ai_clients import GLM46Client, MinimaxM2Client
|
|
|
|
|
|
async def test_glm46():
|
|
"""Test GLM4.6 API via Z.AI"""
|
|
print("\n" + "="*70)
|
|
print("🧪 TEST 1: GLM4.6 API (Z.AI)")
|
|
print("="*70)
|
|
|
|
client = GLM46Client()
|
|
|
|
# Verify config
|
|
print(f"📡 Endpoint: {client.base_url}")
|
|
print(f"🤖 Model: {client.model}")
|
|
print(f"🔑 Token: {client.api_key[:30]}... (length: {len(client.api_key)})")
|
|
|
|
# Test simple request
|
|
print("\n📤 Sending test request...")
|
|
try:
|
|
response = await client.complete(
|
|
"Say exactly: 'GLM4.6 is working!'",
|
|
max_tokens=50,
|
|
temperature=0.1
|
|
)
|
|
print(f"\n✅ GLM4.6 RESPONSE:")
|
|
print(f" {response}")
|
|
return True
|
|
except Exception as e:
|
|
print(f"\n❌ GLM4.6 ERROR: {e}")
|
|
return False
|
|
|
|
|
|
async def test_minimax():
|
|
"""Test Minimax M2 API"""
|
|
print("\n" + "="*70)
|
|
print("🧪 TEST 2: MINIMAX M2 API")
|
|
print("="*70)
|
|
|
|
client = MinimaxM2Client()
|
|
|
|
# Verify config
|
|
print(f"📡 Endpoint: {client.base_url}")
|
|
print(f"🤖 Model: {client.model}")
|
|
print(f"🔑 Token: {client.api_key[:30]}... (length: {len(client.api_key)})")
|
|
|
|
# Test simple request
|
|
print("\n📤 Sending test request...")
|
|
try:
|
|
response = await client.complete(
|
|
"Say exactly: 'Minimax M2 is working!'",
|
|
max_tokens=50
|
|
)
|
|
print(f"\n✅ MINIMAX M2 RESPONSE:")
|
|
print(f" {response}")
|
|
return True
|
|
except Exception as e:
|
|
print(f"\n❌ MINIMAX M2 ERROR: {e}")
|
|
return False
|
|
|
|
|
|
async def main():
|
|
print("\n" + "🎵"*35)
|
|
print("MUSIAIA - API CONNECTIVITY TEST")
|
|
print("🎵"*35)
|
|
|
|
glm_ok = False
|
|
minimax_ok = False
|
|
|
|
# Test GLM4.6
|
|
try:
|
|
glm_ok = await test_glm46()
|
|
except Exception as e:
|
|
print(f"\n❌ GLM4.6 Test crashed: {e}")
|
|
|
|
# Test Minimax
|
|
try:
|
|
minimax_ok = await test_minimax()
|
|
except Exception as e:
|
|
print(f"\n❌ Minimax Test crashed: {e}")
|
|
|
|
# Summary
|
|
print("\n" + "="*70)
|
|
print("📊 TEST SUMMARY")
|
|
print("="*70)
|
|
print(f"GLM4.6 (Z.AI): {'✅ WORKING' if glm_ok else '❌ FAILED'}")
|
|
print(f"Minimax M2: {'✅ WORKING' if minimax_ok else '❌ FAILED'}")
|
|
print("="*70)
|
|
|
|
if glm_ok and minimax_ok:
|
|
print("\n🎉 ALL APIS ARE WORKING! Ready to generate music!")
|
|
elif glm_ok or minimax_ok:
|
|
print(f"\n⚠️ {('GLM4.6' if glm_ok else 'Minimax M2')} is working. You can proceed.")
|
|
else:
|
|
print("\n❌ No APIs are working. Check your credentials.")
|
|
|
|
print()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
asyncio.run(main())
|