Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Final touches
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary-H9 committed Jul 8, 2024
1 parent ca5726c commit 4df1583
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 20 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,21 @@ This repository includes a Django application which presents a simple frontend t

The name 'Ollamate' is derived from Ollama and will be changed if/when this application evolves.

## Getting Started

> [!NOTE]
> 🚧 WIP 🚧

## Running Locally

Ollamate is run in a Development Container via Docker. The Development Container VSCode [extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) is recommended. Additionally ensure [Docker Desktop](https://www.docker.com/products/docker-desktop/) is running.

For more information on Dev Containers, see the [Analytical Platform docs.](https://technical-documentation.data-platform.service.justice.gov.uk/documentation/platform/infrastructure/developing.html#developing-the-data-platform)


### Building the Development Container
Open this repository in Visual Studio Code. Open the Command Palette `Command + Shift + p`, search for and select ```> Dev Containers: Reopen in container```.

The Development Container utilises Docker in Docker to create two containers - `ollama` and `postgresql`. This allows for easy setup when working on Ollamate locally.

### Environment Variables
There is an example `.env.example` file. Paste the contents into a new file called ```.env``` in the root of the project.
2 changes: 1 addition & 1 deletion ollamate/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"django.contrib.messages",
"django.contrib.staticfiles",
"streamingapp",
"azure_auth",
# "azure_auth"
]

MIDDLEWARE = [
Expand Down
12 changes: 6 additions & 6 deletions ollamate/urls.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from django.contrib import admin
from django.urls import include, path

from streamingapp.views import redirect_to_ollama
# from streamingapp.views import redirect_to_ollama

urlpatterns = [
path("admin/", admin.site.urls),
path(
"azure_auth/",
include("azure_auth.urls"),
),
# path(
# "azure_auth/",
# include("azure_auth.urls"),
# ),
path("stream/", include("streamingapp.urls")),
path("", redirect_to_ollama),
# path("", redirect_to_ollama),
]
2 changes: 1 addition & 1 deletion scripts/devcontainer/post-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ docker compose --file contrib/docker-compose-postgres.yml up --detach
docker compose --file contrib/docker-compose-ollama.yml up --detach

# Start Ollama Model
docker exec -it contrib-ollama-1 ollama run orca-mini
docker exec -it contrib-ollama-1 ollama run orca-mini &

# Upgrade Pip
pip install --break-system-package --upgrade pip
Expand Down
11 changes: 2 additions & 9 deletions streamingapp/templates/streamingapp/input_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@
<h1 class="text-3xl font-bold mb-4 text-center">Ollamate 🦙🍵</h1>
<h2 class="text-xl font-bold mb-4 text-center">A Simple Conversational AI.</h2>
<p class="mb-4 text-center">Logged in as: <strong>{{ user.username }}</strong></p>
<div class="mt-4 text-center">
{% if user.is_authenticated %}
<a href="{% url 'azure_auth:logout' %}" class="bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded">Logout</a>
{% else %}
<a href="{% url 'azure_auth:login' %}" class="bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded">Login</a>
{% endif %}
</div>
<p class="mb-4">Enter text below to interact with Ollamate:</p>
<div id="conversation-log" class="bg-white p-4 rounded shadow-lg hidden text-base"></div>
<form id="ollamaForm" class="mt-4">
Expand Down Expand Up @@ -101,7 +94,7 @@ <h2 class="text-xl font-bold mb-4 text-center">A Simple Conversational AI.</h2>
var ollamaResponse = response.response;

var formattedResponse = formatResponse(ollamaResponse);

conversationHistory.push({"role": "assistant", "content": formattedResponse});

$('#conversation-log').append('<div class="conversation mb-4"><span class="ollama-response block text-green-700"><strong>Ollama:</strong> ' + formattedResponse + '</span></div>');
Expand Down Expand Up @@ -133,4 +126,4 @@ <h2 class="text-xl font-bold mb-4 text-center">A Simple Conversational AI.</h2>
});
</script>
</body>
</html>
</html>
2 changes: 1 addition & 1 deletion streamingapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
logging.basicConfig(level=logging.DEBUG)


@azure_auth_required
# @azure_auth_required
def call_ollama(request):
if request.method == "POST":
user_input = request.POST.get("userInput", "")
Expand Down

0 comments on commit 4df1583

Please sign in to comment.