restyle homepage, add config item to add content to the home page

This commit is contained in:
Cyberes 2023-08-24 17:55:55 -06:00
parent d1b227fd43
commit c397649097
5 changed files with 53 additions and 17 deletions

View File

@ -1,6 +1,6 @@
# local-llm-server
_A HTTP API to serve local LLM Models._
_An HTTP API to serve local LLM Models._
The purpose of this server is to abstract your LLM backend from your frontend API. This enables you to make changes to (or even switch) your backend without affecting your clients.

View File

@ -32,6 +32,10 @@ auth_required: false
#analytics_tracking_code: |
# alert("hello");
# HTML to add under the "Estimated Wait Time" line.
#info_html: |
# <a href="https://chub-archive.evulid.cc/#/proxy-stats.html?proxy=proxy_chub_archive_evulid">Historical Stats</a>
## STATS ##
# Display the total_proompts item on the stats screen.
@ -47,4 +51,6 @@ load_num_prompts: true
frontend_api_client: /api
# Relative paths are mapped to the directory of the server
database_path: ./proxy-server.db
database_path: ./proxy-server.db
average_generation_time_mode: database

View File

@ -11,6 +11,7 @@ config_default_vars = {
'show_uptime': True,
'analytics_tracking_code': '',
'average_generation_time_mode': 'database',
'info_html': None,
}
config_required_vars = ['token_limit', 'concurrent_gens', 'mode', 'llm_middleware_name']

View File

@ -111,9 +111,15 @@ def home():
else:
analytics_tracking_code = ''
if config['info_html']:
info_html = '<br>\n' + config['info_html']
else:
info_html = ''
return render_template('home.html',
llm_middleware_name=config['llm_middleware_name'],
analytics_tracking_code=analytics_tracking_code,
info_html=info_html,
current_model=running_model,
client_api=opts.full_client_api,
estimated_wait=estimated_wait_sec,

View File

@ -5,19 +5,34 @@
<title>{{ llm_middleware_name }}</title>
<meta content="width=device-width, initial-scale=1" name="viewport"/>
{{ analytics_tracking_code|safe }}
<!-- https://highlightjs.org/demo#lang=json -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/github.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js"></script>
<style>
.container {
padding: 1em 3em;
}
#json {
background-color: #ffb6c16e;
background-color: rgb(229 231 235);
padding: 1em;
display: inline-block;
margin: auto;
max-width: 95%;
}
body {
background-color: rgb(229 231 235);
}
.info-box {
background-color: white;
padding: 1em;
margin: auto;
border-radius: 10px;
max-width: 95%;
}
a, a:visited {
color: blue;
}
@ -49,30 +64,38 @@
<div class="container">
<h1 style="text-align: center;margin-top: 0;">{{ llm_middleware_name }}</h1>
<p><strong>Current Model:</strong> <span id="model">{{ current_model }}</span></p>
<p><strong>Client API URL:</strong> {{ client_api }}</p>
<p><strong>Estimated Wait Time:</strong> <span id="estimatedWait">{{ estimated_wait }}</span></p>
<div class="info-box">
<p><strong>Current Model:</strong> <span id="model">{{ current_model }}</span></p>
<p><strong>Client API URL:</strong> {{ client_api }}</p>
<p><strong>Estimated Wait Time:</strong> <span id="estimatedWait">{{ estimated_wait }}</span></p>
{{ info_html|safe }}
</div>
<br>
<div id="oobabooga">
<strong>Instructions:</strong>
<ol>
<li>Set your API type to <kbd>{{ mode_name }}</kbd></li>
<li>Enter <kbd>{{ client_api }}</kbd> in the <kbd>{{ api_input_textbox }}</kbd> textbox.</li>
<li>Click <kbd>Connect</kbd> to test the connection.</li>
<li>Open your preset config and set <kbd>Context Size</kbd> to {{ context_size }}.</li>
<li>Follow this guide to get set up: <a href="https://rentry.org/freellamas" target="_blank">rentry.org/freellamas</a></li>
</ol>
<div class="info-box">
<div id="oobabooga">
<strong>Instructions:</strong>
<ol>
<li>Set your API type to <kbd>{{ mode_name }}</kbd></li>
<li>Enter <kbd>{{ client_api }}</kbd> in the <kbd>{{ api_input_textbox }}</kbd> textbox.</li>
<li>Click <kbd>Connect</kbd> to test the connection.</li>
<li>Open your preset config and set <kbd>Context Size</kbd> to {{ context_size }}.</li>
<li>Follow this guide to get set up: <a href="https://rentry.org/freellamas" target="_blank">rentry.org/freellamas</a></li>
</ol>
</div>
</div>
<br><br>
<br>
<pre id="json">{{ stats_json|safe }}</pre>
<div class="info-box">
<pre><code class="language-json" style="background-color: white">{{ stats_json|safe }}</code></pre>
</div>
</div>
<div class="footer">
<a href="https://git.evulid.cc/cyberes/local-llm-server" target="_blank">git.evulid.cc/cyberes/local-llm-server</a>
</div>
<script>hljs.highlightAll();</script>
</body>
</html>