- web/index.html: GitLab-ähnliches Dark-Theme UI - web/templates.json: Dynamische Template-Metadaten - web/serve.py: Python Dev-Server (Port 8080) - Templates werden automatisch gescannt und angezeigt - Features: Suche, Filter, Kopieren von Pfaden - Styling angelehnt an server_tool frontend Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
34 lines
980 B
Python
Executable file
34 lines
980 B
Python
Executable file
#!/usr/bin/env python3
|
|
"""
|
|
Minimaler Entwicklungs-Server für die Prompt Templates Webansicht.
|
|
Startet auf Port 8080 und dient die statischen Dateien aus.
|
|
"""
|
|
|
|
import http.server
|
|
import socketserver
|
|
import os
|
|
|
|
PORT = 8080
|
|
DIRECTORY = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
class Handler(http.server.SimpleHTTPRequestHandler):
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, directory=DIRECTORY, **kwargs)
|
|
|
|
def do_GET(self):
|
|
# Für Root-Pfad: index.htmlservieren
|
|
if self.path == '/' or self.path == '/index.html':
|
|
self.path = '/index.html'
|
|
return super().do_GET()
|
|
|
|
def main():
|
|
with socketserver.TCPServer(("", PORT), Handler) as httpd:
|
|
print(f"Serving Prompt Templates on http://localhost:{PORT}")
|
|
print(f"Press Ctrl+C to stop")
|
|
try:
|
|
httpd.serve_forever()
|
|
except KeyboardInterrupt:
|
|
print("\nServer stopped")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|