From d98feaccb807a17530342777a2db57bfc3a4ed42 Mon Sep 17 00:00:00 2001
From: Gary H <26419401+Gary-H9@users.noreply.github.com>
Date: Wed, 17 Jul 2024 07:54:55 +0000
Subject: [PATCH 1/7] :wrench: Update views
---
streamingapp/templates/streamingapp/base.html | 18 +++
.../templates/streamingapp/input_form.html | 131 +-----------------
templates/base.html | 19 +++
templates/home.html | 25 ++++
templates/includes/conversation.html | 67 +++++++++
templates/includes/footer.html | 37 +++++
templates/includes/header.html | 31 +++++
templates/includes/model_selector.html | 10 ++
templates/includes/moj_header.svg | 7 +
templates/includes/nav_item.html | 3 +
templates/includes/navigation.html | 20 +++
templates/includes/phase_banner.html | 12 ++
templates/login-fail.html | 11 ++
13 files changed, 264 insertions(+), 127 deletions(-)
create mode 100644 streamingapp/templates/streamingapp/base.html
create mode 100644 templates/base.html
create mode 100644 templates/home.html
create mode 100644 templates/includes/conversation.html
create mode 100644 templates/includes/footer.html
create mode 100644 templates/includes/header.html
create mode 100644 templates/includes/model_selector.html
create mode 100644 templates/includes/moj_header.svg
create mode 100644 templates/includes/nav_item.html
create mode 100644 templates/includes/navigation.html
create mode 100644 templates/includes/phase_banner.html
create mode 100644 templates/login-fail.html
diff --git a/streamingapp/templates/streamingapp/base.html b/streamingapp/templates/streamingapp/base.html
new file mode 100644
index 0000000..95113aa
--- /dev/null
+++ b/streamingapp/templates/streamingapp/base.html
@@ -0,0 +1,18 @@
+{% load static %}
+
+
+
+
+
+ Ollamate 🦙🍵
+
+
+
+ {% include "includes/header.html" %}
+ {% include "includes/phase_banner.html" %}
+ {% block content %}{% endblock %}
+
+
+
+{% include "includes/footer.html" %}
+
diff --git a/streamingapp/templates/streamingapp/input_form.html b/streamingapp/templates/streamingapp/input_form.html
index 9cc29fc..6ade7a9 100644
--- a/streamingapp/templates/streamingapp/input_form.html
+++ b/streamingapp/templates/streamingapp/input_form.html
@@ -1,130 +1,7 @@
-
-
-
-
- Ollamate 🦙🍵
-
-
-
-
-
-
-
A Proof of Concept by the Analytical Platform
-
-
-
Ollamate 🦙🍵
-
A Simple Conversational AI.
-
Logged in as: {{ user.username }}
-
Enter text below to interact with Ollamate:
-
-
-
+{% extends "streamingapp/base.html" %}
-
+{% block content %}
-
-
-
-
-
+{% endblock %}
diff --git a/templates/base.html b/templates/base.html
new file mode 100644
index 0000000..05d4976
--- /dev/null
+++ b/templates/base.html
@@ -0,0 +1,19 @@
+
+{% extends "govuk_frontend_django/base.html" %}
+{% load static govuk_frontend_django %}
+
+{% block title %}Analytical Platform{% endblock title %}
+
+{% block head %}
+
+{% endblock head %}
+
+{% block header %}
+ {% include "includes/header.html" %}
+{% endblock header %}
+
+
+{% block body_end %}
+
+
+{% endblock body_end %}
diff --git a/templates/home.html b/templates/home.html
new file mode 100644
index 0000000..f857201
--- /dev/null
+++ b/templates/home.html
@@ -0,0 +1,25 @@
+
+
+{% extends "base.html" %}
+
+{% block content %}
+
+{% if user.is_authenticated %}
+
+{{ user.email }}
+{{ user.name }}
+{{ user.user_id }}
+
+
+User list
+{% for user in users %}
+ {{ user.name }}: {{ user.nickname }}, {{ user.email }}
+{% endfor %}
+
+logout
+
+{% else %}
+login
+{% endif %}
+
+{% endblock %}
diff --git a/templates/includes/conversation.html b/templates/includes/conversation.html
new file mode 100644
index 0000000..6d7e464
--- /dev/null
+++ b/templates/includes/conversation.html
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
diff --git a/templates/includes/footer.html b/templates/includes/footer.html
new file mode 100644
index 0000000..dbd1928
--- /dev/null
+++ b/templates/includes/footer.html
@@ -0,0 +1,37 @@
+
diff --git a/templates/includes/header.html b/templates/includes/header.html
new file mode 100644
index 0000000..b1f4170
--- /dev/null
+++ b/templates/includes/header.html
@@ -0,0 +1,31 @@
+
+
+{% include "includes/navigation.html" %}
diff --git a/templates/includes/model_selector.html b/templates/includes/model_selector.html
new file mode 100644
index 0000000..3066730
--- /dev/null
+++ b/templates/includes/model_selector.html
@@ -0,0 +1,10 @@
+
+
+
+
diff --git a/templates/includes/moj_header.svg b/templates/includes/moj_header.svg
new file mode 100644
index 0000000..c7cc135
--- /dev/null
+++ b/templates/includes/moj_header.svg
@@ -0,0 +1,7 @@
+{% load static %}
+
diff --git a/templates/includes/nav_item.html b/templates/includes/nav_item.html
new file mode 100644
index 0000000..f306046
--- /dev/null
+++ b/templates/includes/nav_item.html
@@ -0,0 +1,3 @@
+
+ {{ item.name }}
+
diff --git a/templates/includes/navigation.html b/templates/includes/navigation.html
new file mode 100644
index 0000000..28abbaa
--- /dev/null
+++ b/templates/includes/navigation.html
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/includes/phase_banner.html b/templates/includes/phase_banner.html
new file mode 100644
index 0000000..b9a6bf5
--- /dev/null
+++ b/templates/includes/phase_banner.html
@@ -0,0 +1,12 @@
+
diff --git a/templates/login-fail.html b/templates/login-fail.html
new file mode 100644
index 0000000..3ed365f
--- /dev/null
+++ b/templates/login-fail.html
@@ -0,0 +1,11 @@
+
+
+
+
+ Login failed
+
+
+ Login refused, your session was expired, please re-login
+ login
+
+
From 0328b5c84190a755e09f9806246e030e7daa3a07 Mon Sep 17 00:00:00 2001
From: Gary H <26419401+Gary-H9@users.noreply.github.com>
Date: Wed, 17 Jul 2024 08:06:03 +0000
Subject: [PATCH 2/7] Add packages
---
package-lock.json | 314 +++++++++++++++++++++++++++++++++++++++++++++-
package.json | 19 ++-
requirements.txt | 3 +
3 files changed, 334 insertions(+), 2 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index ace255c..dbdf944 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,318 @@
{
"name": "analytical-platform-ollamate",
+ "version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
- "packages": {}
+ "packages": {
+ "": {
+ "name": "analytical-platform-ollamate",
+ "version": "1.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "@ministryofjustice/frontend": "2.1.3",
+ "govuk-frontend": "5.4.0",
+ "jquery": "3.7.1",
+ "nunjucks": "3.2.4"
+ },
+ "devDependencies": {
+ "sass": "1.77.6"
+ }
+ },
+ "node_modules/@ministryofjustice/frontend": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/@ministryofjustice/frontend/-/frontend-2.1.3.tgz",
+ "integrity": "sha512-kFStfY6Ckbx9OGUEf2xXAjG8oUGXpARpbogk569MTH5LnI1txVT0NieskA4Vthic+2yQ++bePtKX46U1f30rLA==",
+ "dependencies": {
+ "govuk-frontend": "^5.0.0",
+ "moment": "^2.27.0"
+ },
+ "engines": {
+ "node": ">= 4.2.0"
+ },
+ "peerDependencies": {
+ "jquery": "^3.6.0"
+ }
+ },
+ "node_modules/a-sync-waterfall": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz",
+ "integrity": "sha512-RYTOHHdWipFUliRFMCS4X2Yn2X8M87V/OpSqWzKKOGhzqyUxzyVmhHDH9sAvG+ZuQf/TAOFsLCpMw09I1ufUnA=="
+ },
+ "node_modules/anymatch": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
+ "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
+ "devOptional": true,
+ "dependencies": {
+ "normalize-path": "^3.0.0",
+ "picomatch": "^2.0.4"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/asap": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
+ "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA=="
+ },
+ "node_modules/binary-extensions": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
+ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
+ "devOptional": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/braces": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
+ "devOptional": true,
+ "dependencies": {
+ "fill-range": "^7.1.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/chokidar": {
+ "version": "3.5.3",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
+ "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
+ "devOptional": true,
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://paulmillr.com/funding/"
+ }
+ ],
+ "dependencies": {
+ "anymatch": "~3.1.2",
+ "braces": "~3.0.2",
+ "glob-parent": "~5.1.2",
+ "is-binary-path": "~2.1.0",
+ "is-glob": "~4.0.1",
+ "normalize-path": "~3.0.0",
+ "readdirp": "~3.6.0"
+ },
+ "engines": {
+ "node": ">= 8.10.0"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.2"
+ }
+ },
+ "node_modules/commander": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz",
+ "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/fill-range": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
+ "devOptional": true,
+ "dependencies": {
+ "to-regex-range": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/glob-parent": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+ "devOptional": true,
+ "dependencies": {
+ "is-glob": "^4.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/govuk-frontend": {
+ "version": "5.4.0",
+ "resolved": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-5.4.0.tgz",
+ "integrity": "sha512-F3YwQYrYQqIPfNxsoph6O78Ey1unCB6cy6omx8KeWY9G504lWZFBSIaiUCma1jNLw9bOUU7Ui+tXG09jjqy0Mw==",
+ "engines": {
+ "node": ">= 4.2.0"
+ }
+ },
+ "node_modules/immutable": {
+ "version": "4.3.4",
+ "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.4.tgz",
+ "integrity": "sha512-fsXeu4J4i6WNWSikpI88v/PcVflZz+6kMhUfIwc5SY+poQRPnaf5V7qds6SUyUN3cVxEzuCab7QIoLOQ+DQ1wA==",
+ "dev": true
+ },
+ "node_modules/is-binary-path": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+ "devOptional": true,
+ "dependencies": {
+ "binary-extensions": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
+ "devOptional": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-glob": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
+ "devOptional": true,
+ "dependencies": {
+ "is-extglob": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "devOptional": true,
+ "engines": {
+ "node": ">=0.12.0"
+ }
+ },
+ "node_modules/jquery": {
+ "version": "3.7.1",
+ "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz",
+ "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg=="
+ },
+ "node_modules/moment": {
+ "version": "2.29.4",
+ "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
+ "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
+ "devOptional": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/nunjucks": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/nunjucks/-/nunjucks-3.2.4.tgz",
+ "integrity": "sha512-26XRV6BhkgK0VOxfbU5cQI+ICFUtMLixv1noZn1tGU38kQH5A5nmmbk/O45xdyBhD1esk47nKrY0mvQpZIhRjQ==",
+ "dependencies": {
+ "a-sync-waterfall": "^1.0.0",
+ "asap": "^2.0.3",
+ "commander": "^5.1.0"
+ },
+ "bin": {
+ "nunjucks-precompile": "bin/precompile"
+ },
+ "engines": {
+ "node": ">= 6.9.0"
+ },
+ "peerDependencies": {
+ "chokidar": "^3.3.0"
+ },
+ "peerDependenciesMeta": {
+ "chokidar": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/picomatch": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
+ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
+ "devOptional": true,
+ "engines": {
+ "node": ">=8.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/readdirp": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
+ "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
+ "devOptional": true,
+ "dependencies": {
+ "picomatch": "^2.2.1"
+ },
+ "engines": {
+ "node": ">=8.10.0"
+ }
+ },
+ "node_modules/sass": {
+ "version": "1.77.6",
+ "resolved": "https://registry.npmjs.org/sass/-/sass-1.77.6.tgz",
+ "integrity": "sha512-ByXE1oLD79GVq9Ht1PeHWCPMPB8XHpBuz1r85oByKHjZY6qV6rWnQovQzXJXuQ/XyE1Oj3iPk3lo28uzaRA2/Q==",
+ "dev": true,
+ "dependencies": {
+ "chokidar": ">=3.0.0 <4.0.0",
+ "immutable": "^4.0.0",
+ "source-map-js": ">=0.6.2 <2.0.0"
+ },
+ "bin": {
+ "sass": "sass.js"
+ },
+ "engines": {
+ "node": ">=14.0.0"
+ }
+ },
+ "node_modules/source-map-js": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
+ "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "devOptional": true,
+ "dependencies": {
+ "is-number": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=8.0"
+ }
+ }
+ }
}
diff --git a/package.json b/package.json
index 4daec64..cb48f02 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,22 @@
{
"name": "analytical-platform-ollamate",
"version": "1.0.0",
- "description": "Analytical Platform Ollamate"
+ "description": "Analytical Platform Ollamate",
+ "directories": {
+ "test": "tests"
+ },
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1",
+ "css": "sass --load-path=./ --style=compressed assets/scss/app.scss:static/app.css"
+ },
+ "license": "MIT",
+ "devDependencies": {
+ "sass": "1.77.6"
+ },
+ "dependencies": {
+ "@ministryofjustice/frontend": "2.1.3",
+ "govuk-frontend": "5.4.0",
+ "jquery": "3.7.1",
+ "nunjucks": "3.2.4"
+ }
}
diff --git a/requirements.txt b/requirements.txt
index 5a1c302..446668e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,9 @@
django-azure-auth==2.0.0
django-environ==0.11.2
+govuk-frontend-django==0.9.1
+gunicorn==22.0.0
psycopg==3.2.1
pytest==8.0.0
pytest-django==4.8.0
requests==2.32.3
+uvicorn[standard]==0.30.1
From 4a20d80c5ddb81e62751eb846eabe930f64a70bf Mon Sep 17 00:00:00 2001
From: Gary H <26419401+Gary-H9@users.noreply.github.com>
Date: Wed, 17 Jul 2024 08:19:33 +0000
Subject: [PATCH 3/7] Miscellaneous
---
.gitignore | 3 ++-
Dockerfile | 21 +++++++++++----------
Makefile | 16 ++++++++++++++++
assets/scss/app.scss | 7 +++++++
ollamate/settings.py | 29 +++++++++++++++++------------
scripts/container/entrypoint.sh | 2 +-
scripts/devcontainer/post-create.sh | 6 +++---
7 files changed, 57 insertions(+), 27 deletions(-)
create mode 100644 assets/scss/app.scss
diff --git a/.gitignore b/.gitignore
index 0762719..65e5857 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,4 +16,5 @@ __pycache__
node_modules/
/static/
/run/
-db.sqlite3
\ No newline at end of file
+db.sqlite3
+staticfiles/
diff --git a/Dockerfile b/Dockerfile
index 7d1e075..2c2beb6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,11 +1,11 @@
-# FROM public.ecr.aws/docker/library/node:20.11.1 AS build-node
+FROM public.ecr.aws/docker/library/node:20.11.1 AS build-node
-# WORKDIR /
-# COPY package.json package-lock.json ./
-# COPY assets/scss/app.scss ./assets/scss/app.scss
+WORKDIR /
+COPY package.json package-lock.json ./
+COPY assets/scss/app.scss ./assets/scss/app.scss
-# RUN npm install \
-# && npm run css
+RUN npm install \
+ && npm run css
FROM public.ecr.aws/docker/library/python:3.12-alpine3.19 AS base
@@ -21,13 +21,14 @@ RUN mkdir --parents static/assets/fonts \
&& mkdir --parents static/assets/images \
&& mkdir --parents static/assets/js
-# COPY --from=build-node static/app.css static/app.css
-# COPY --from=build-node node_modules/govuk-frontend/dist/govuk/assets/fonts/. static/assets/fonts
-# COPY --from=build-node node_modules/govuk-frontend/dist/govuk/assets/images/. static/assets/images
-# COPY --from=build-node node_modules/govuk-frontend/dist/govuk/all.bundle.js static/assets/js/govuk.js
+COPY --from=build-node static/app.css static/app.css
+COPY --from=build-node node_modules/govuk-frontend/dist/govuk/assets/fonts/. static/assets/fonts
+COPY --from=build-node node_modules/govuk-frontend/dist/govuk/assets/images/. static/assets/images
+COPY --from=build-node node_modules/govuk-frontend/dist/govuk/all.bundle.js static/assets/js/govuk.js
COPY scripts/container/entrypoint.sh /usr/local/bin/entrypoint.sh
COPY requirements.txt manage.py ./
COPY ollamate ollamate
+COPY streamingapp streamingapp
# COPY tests tests
RUN pip install --no-cache-dir --requirement requirements.txt \
diff --git a/Makefile b/Makefile
index c3916a7..0041a72 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,21 @@
#!make
+build-static:
+ make build-css
+ make build-js
+
+build-css:
+ mkdir -p static/assets/fonts
+ mkdir -p static/assets/images
+ cp -R node_modules/govuk-frontend/dist/govuk/assets/fonts/. static/assets/fonts
+ cp -R node_modules/govuk-frontend/dist/govuk/assets/images/. static/assets/images
+ npm run css
+
+build-js:
+ mkdir -p static/assets/js
+ cp node_modules/govuk-frontend/dist/govuk/all.bundle.js static/assets/js/govuk.js
+ cp node_modules/govuk-frontend/dist/govuk/all.bundle.js.map static/assets/js/govuk.js.map
+
db-migrate:
python manage.py migrate
diff --git a/assets/scss/app.scss b/assets/scss/app.scss
new file mode 100644
index 0000000..d72dee3
--- /dev/null
+++ b/assets/scss/app.scss
@@ -0,0 +1,7 @@
+$govuk-assets-path: "/static/assets/";
+
+ /* stylelint-disable import-notation */
+@import "node_modules/govuk-frontend/dist/govuk/all";
+@import "node_modules/@ministryofjustice/frontend/moj/all";
+
+ /* stylelint-enable */
diff --git a/ollamate/settings.py b/ollamate/settings.py
index 3c8d461..e227e90 100644
--- a/ollamate/settings.py
+++ b/ollamate/settings.py
@@ -28,12 +28,13 @@
print(f"Loading environment variables from {env_file}")
environ.Env.read_env(env_file)
else:
- print("Fix environment variables.")
+ print("...")
+ # print("Fix environment variables.")
# print(f"{env_file} not found")
- # print("CLIENT_ID:", env("CLIENT_ID"))
- # print("CLIENT_SECRET:", env("CLIENT_SECRET"))
- # print("TENANT_ID:", env("AZURE_TENANT_ID"))
- # print("REDIRECT_URI:", env("REDIRECT_URI"))
+ # print("CLIENT_ID:", os.environ.get("CLIENT_ID"))
+ # print("CLIENT_SECRET:", os.environ.get("CLIENT_SECRET"))
+ # print("TENANT_ID:", os.environ.get("AZURE_TENANT_ID"))
+ # print("REDIRECT_URI:", os.environ.get("REDIRECT_URI"))
# Build paths inside the project like this: BASE_DIR / 'subdir'.
# BASE_DIR = Path(__file__).resolve().parent.parent
@@ -42,7 +43,7 @@
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
-SECRET_KEY = env("SECRET_KEY")
+SECRET_KEY = os.environ.get("SECRET_KEY")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
@@ -60,7 +61,8 @@
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
- "streamingapp",
+ "ollamate",
+ "streamingapp"
# "azure_auth"
]
@@ -79,7 +81,7 @@
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
- "DIRS": [],
+ "DIRS": [os.path.join(BASE_DIR, "templates")],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
@@ -153,6 +155,9 @@
# https://docs.djangoproject.com/en/5.0/howto/static-files/
STATIC_URL = "static/"
+STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
+STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]
+
# Default primary key field type
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field
@@ -162,12 +167,12 @@
# Azure authentication settings
AZURE_AUTH = {
- "CLIENT_ID": env("CLIENT_ID"),
- "CLIENT_SECRET": env("CLIENT_SECRET"),
- "REDIRECT_URI": env("REDIRECT_URI"),
+ "CLIENT_ID": os.environ.get("CLIENT_ID"),
+ "CLIENT_SECRET": os.environ.get("CLIENT_SECRET"),
+ "REDIRECT_URI": os.environ.get("REDIRECT_URI"),
"SCOPES": ["User.Read"],
"AUTHORITY": "https://login.microsoftonline.com/{}".format(
- env("AZURE_TENANT_ID")
+ os.environ.get("AZURE_TENANT_ID")
), # Or https://login.microsoftonline.com/common if multi-tenant
# # "LOGOUT_URI": "https:///logout", # Optional
# # "PUBLIC_URLS": ["",], # Optional, public views accessible by non-authenticated users
diff --git a/scripts/container/entrypoint.sh b/scripts/container/entrypoint.sh
index 157e723..26d1bbc 100644
--- a/scripts/container/entrypoint.sh
+++ b/scripts/container/entrypoint.sh
@@ -8,7 +8,7 @@ WORKERS=${WORKERS:-"4"}
case "$MODE" in
"run")
echo "Running Django server on ${ADDRESS}:${PORT}"
- gunicorn -b "${ADDRESS}":"${PORT}" -k uvicorn.workers.UvicornWorker -w "${WORKERS}" ap.asgi:application
+ gunicorn -b "${ADDRESS}":"${PORT}" -k uvicorn.workers.UvicornWorker -w "${WORKERS}" ollamate.asgi:application
;;
"migrate")
echo "Running Django migrations"
diff --git a/scripts/devcontainer/post-create.sh b/scripts/devcontainer/post-create.sh
index f0a6161..35c29fb 100644
--- a/scripts/devcontainer/post-create.sh
+++ b/scripts/devcontainer/post-create.sh
@@ -15,9 +15,9 @@ pip install --break-system-package --upgrade pip
# Install dependencies
pip install --break-system-package --requirement requirements.dev.txt
-# install npm dependencies and static assets
-# npm install
-# make build-static
+# Install npm dependencies and static assets
+npm install
+make build-static
# Run migrations
python manage.py migrate
From 3d35c0dbdaf321d5887ea0e6c78ba15d267d7e7f Mon Sep 17 00:00:00 2001
From: Gary H <26419401+Gary-H9@users.noreply.github.com>
Date: Thu, 18 Jul 2024 14:20:59 +0000
Subject: [PATCH 4/7] :wrench: Add loading message dots
---
templates/includes/conversation.html | 58 ++++++++++++++++++++++------
templates/includes/phase_banner.html | 4 +-
2 files changed, 48 insertions(+), 14 deletions(-)
diff --git a/templates/includes/conversation.html b/templates/includes/conversation.html
index 6d7e464..de70216 100644
--- a/templates/includes/conversation.html
+++ b/templates/includes/conversation.html
@@ -1,15 +1,10 @@
-