Compare commits

...
Sign in to create a new pull request.

2 commits

View file

@ -1,4 +1,4 @@
from flask import Flask, request, jsonify
from flask import Flask, request, jsonify, render_template_string
from datetime import datetime
import os
import json
@ -687,6 +687,99 @@ def play_blackjack(bet, agent_id, game_id=None, action=None):
LOCK_TIMEOUT = 2 # Seconds to wait for lock acquisition
@app.route("/", methods=["GET"])
def index():
logger.info("Received / GET request")
html_template = """
<!DOCTYPE html>
<html>
<head>
<title>SLOP API Server</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 50px auto;
padding: 20px;
background-color: #f5f5f5;
}
h1 {
color: #333;
border-bottom: 2px solid #4CAF50;
padding-bottom: 10px;
}
.links {
margin: 20px 0;
}
.links a {
display: block;
margin: 10px 0;
padding: 10px;
background-color: white;
border: 1px solid #ddd;
border-radius: 5px;
text-decoration: none;
color: #333;
transition: all 0.3s;
}
.links a:hover {
background-color: #4CAF50;
color: white;
border-color: #4CAF50;
}
.endpoints {
background-color: white;
padding: 20px;
border-radius: 5px;
margin-top: 20px;
}
.endpoints h2 {
color: #666;
font-size: 1.2em;
}
.endpoints ul {
list-style-type: none;
padding-left: 0;
}
.endpoints li {
padding: 5px 0;
color: #555;
}
.endpoints code {
background-color: #f0f0f0;
padding: 2px 5px;
border-radius: 3px;
font-family: monospace;
}
</style>
</head>
<body>
<h1>SLOP API Server</h1>
<p>Welcome to the SLOP API Server v1.0</p>
<div class="links">
<h2>Available Interfaces:</h2>
<a href="https://streamlit.slop.unturf.com/">Streamlit UI</a>
<a href="/openapi">OpenAPI Documentation</a>
</div>
<div class="endpoints">
<h2>API Endpoints:</h2>
<ul>
<li><code>/memory</code> - Memory storage endpoints</li>
<li><code>/chat</code> - Chat completion endpoint</li>
<li><code>/models</code> - List available models</li>
<li><code>/tools</code> - Tool execution endpoints</li>
<li><code>/resources</code> - Resource management</li>
<li><code>/pay</code> - Payment processing</li>
</ul>
</div>
</body>
</html>
"""
return render_template_string(html_template)
@app.route("/memory", methods=["POST"])
def store_memory():
logger.info("Received /memory POST request")