Add HTML homepage with links to Streamlit UI and OpenAPI docs
This commit is contained in:
parent
5a7ead0335
commit
4be66b7380
1 changed files with 89 additions and 14 deletions
|
|
@ -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
|
||||
|
|
@ -690,19 +690,94 @@ LOCK_TIMEOUT = 2 # Seconds to wait for lock acquisition
|
|||
@app.route("/", methods=["GET"])
|
||||
def index():
|
||||
logger.info("Received / GET request")
|
||||
return jsonify({
|
||||
"message": "SLOP API Server",
|
||||
"version": "1.0",
|
||||
"streamlit_ui": "https://streamlit.slop.unturf.com/",
|
||||
"endpoints": {
|
||||
"/memory": "Memory storage endpoints",
|
||||
"/chat": "Chat completion endpoint",
|
||||
"/models": "List available models",
|
||||
"/tools": "Tool execution endpoints",
|
||||
"/resources": "Resource management",
|
||||
"/pay": "Payment processing"
|
||||
}
|
||||
})
|
||||
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"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue