From df5b0b4400784d5e039429158642ef8c9801cbd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Guti=C3=A9rrez?= Date: Fri, 30 Jan 2026 12:56:01 +0100 Subject: [PATCH] Add CI and related fixes (#1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.gutierrezdequevedo.com/ps/model-viewer/pulls/1 Co-authored-by: Juanjo GutiƩrrez Co-committed-by: Juanjo GutiƩrrez --- .drone.yml | 36 ++++++++++++++++++++++++++++++++++++ Dockerfile | 10 ++++++++++ README.md | 32 ++++++++++++++++++++++++++++++++ app.py | 9 ++++----- requirements.txt | 3 ++- static/index.html | 6 +++--- 6 files changed, 87 insertions(+), 9 deletions(-) create mode 100644 .drone.yml create mode 100644 Dockerfile create mode 100644 README.md diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..84606b9 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,36 @@ +--- +kind: pipeline +type: docker +name: default + +steps: +- name: docker image build + image: plugins/docker + settings: + tags: + - latest + repo: docker.gutierrezdequevedo.com/ps/model-viewer + +--- +kind: pipeline +type: docker +name: notification + +depends_on: +- default + +steps: +- name: notify matrix + image: spotlightkid/drone-matrixchat-notify + settings: + homeserver: 'https://grava.work' + roomid: '!wMVeFx6jwwF0TWA18h:grava.work' + userid: '@juanjo:grava.work' + deviceid: 'drone CI' + accesstoken: G66FRa3fG7qNfM4KKoW5wx6TWophvvtF + markdown: 'yes' + template: | + `${DRONE_REPO}` build #${DRONE_BUILD_NUMBER} status: **${DRONE_BUILD_STATUS}** + + [${DRONE_BUILD_LINK}] + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c5a6e02 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM python:3.14-slim + +WORKDIR /app + +COPY . . +RUN pip install --no-cache-dir -r requirements.txt + +EXPOSE 8000 + +CMD ["python", "-m", "gunicorn", "app:app", "--access-logfile", "-", "-b", "0.0.0.0:8000"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..0015511 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# OpenAI Models Viewer + +A web-based interface for browsing and interacting with OpenAI-compatible API endpoints. This application allows you to manage multiple server connections, view available models, and chat with AI models directly from your browser. + +## Features + +- **Multi-Server Management**: Add and manage multiple OpenAI-compatible endpoints +- **Model Discovery**: Browse and view all available models from configured servers +- **Interactive Chat**: Chat directly with AI models through a clean web interface +- **Local Storage**: Securely stores server configurations in browser localStorage +- **Responsive Design**: Works on desktop and mobile devices + +### Docker Support + +Build and run with Docker: + +```bash +docker build -t openai-models-viewer . +docker run -p 8000:8000 openai-models-viewer +``` + +## API Endpoints + +The application connects to standard OpenAI-compatible endpoints: +- `/models` - List available models +- `/v1/chat/completions` - Chat completion endpoint + +## Security + +- API keys are stored locally in browser localStorage +- All communication happens directly between your browser and the API endpoints +- No server-side storage of sensitive information diff --git a/app.py b/app.py index 2454536..ea16a6c 100644 --- a/app.py +++ b/app.py @@ -1,18 +1,17 @@ from flask import Flask, send_from_directory -import os app = Flask(__name__, static_folder='static', static_url_path='/static') + @app.route('/') def index(): return send_from_directory('static', 'index.html') -# Serve static files + @app.route('/') def static_files(filename): return send_from_directory('static', filename) + if __name__ == '__main__': - import sys - port = int(sys.argv[1]) if len(sys.argv) > 1 else 5000 - app.run(debug=True, host='0.0.0.0', port=port) + app.run(debug=True, host='0.0.0.0', port=5000) diff --git a/requirements.txt b/requirements.txt index 5eaf725..f941d23 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ flask -requests \ No newline at end of file +gunicorn +requests diff --git a/static/index.html b/static/index.html index 4a9f90c..804f268 100644 --- a/static/index.html +++ b/static/index.html @@ -4,7 +4,7 @@ OpenAI Models Viewer - +
@@ -91,6 +91,6 @@
- + - \ No newline at end of file +