From 829294b337c4a6118273bd52060fff61c12825e9 Mon Sep 17 00:00:00 2001 From: Tristan Smith Date: Tue, 11 Jun 2024 00:04:26 -0400 Subject: [PATCH] It works, poorly, but it works. --- chat/__init__.py | 0 chat/__pycache__/__init__.cpython-312.pyc | Bin 0 -> 151 bytes chat/__pycache__/admin.cpython-312.pyc | Bin 0 -> 195 bytes chat/__pycache__/apps.cpython-312.pyc | Bin 0 -> 453 bytes chat/__pycache__/models.cpython-312.pyc | Bin 0 -> 192 bytes chat/__pycache__/urls.cpython-312.pyc | Bin 0 -> 417 bytes chat/__pycache__/views.cpython-312.pyc | Bin 0 -> 3162 bytes chat/admin.py | 3 + chat/apps.py | 6 + chat/migrations/__init__.py | 0 .../__pycache__/__init__.cpython-312.pyc | Bin 0 -> 162 bytes chat/models.py | 3 + chat/templates/chat/index.html | 133 ++++++++++++++++++ chat/tests.py | 3 + chat/urls.py | 7 + chat/views.py | 52 +++++++ db.sqlite3 | Bin 0 -> 131072 bytes manage.py | 22 +++ ollama/__init__.py | 0 ollama/__pycache__/__init__.cpython-312.pyc | Bin 0 -> 153 bytes ollama/__pycache__/settings.cpython-312.pyc | Bin 0 -> 2533 bytes ollama/__pycache__/urls.cpython-312.pyc | Bin 0 -> 438 bytes ollama/__pycache__/wsgi.cpython-312.pyc | Bin 0 -> 639 bytes ollama/asgi.py | 16 +++ ollama/settings.py | 124 ++++++++++++++++ ollama/urls.py | 9 ++ ollama/wsgi.py | 16 +++ 27 files changed, 394 insertions(+) create mode 100644 chat/__init__.py create mode 100644 chat/__pycache__/__init__.cpython-312.pyc create mode 100644 chat/__pycache__/admin.cpython-312.pyc create mode 100644 chat/__pycache__/apps.cpython-312.pyc create mode 100644 chat/__pycache__/models.cpython-312.pyc create mode 100644 chat/__pycache__/urls.cpython-312.pyc create mode 100644 chat/__pycache__/views.cpython-312.pyc create mode 100644 chat/admin.py create mode 100644 chat/apps.py create mode 100644 chat/migrations/__init__.py create mode 100644 chat/migrations/__pycache__/__init__.cpython-312.pyc create mode 100644 chat/models.py create mode 100644 chat/templates/chat/index.html create mode 100644 chat/tests.py create mode 100644 chat/urls.py create mode 100644 chat/views.py create mode 100644 db.sqlite3 create mode 100755 manage.py create mode 100644 ollama/__init__.py create mode 100644 ollama/__pycache__/__init__.cpython-312.pyc create mode 100644 ollama/__pycache__/settings.cpython-312.pyc create mode 100644 ollama/__pycache__/urls.cpython-312.pyc create mode 100644 ollama/__pycache__/wsgi.cpython-312.pyc create mode 100644 ollama/asgi.py create mode 100644 ollama/settings.py create mode 100644 ollama/urls.py create mode 100644 ollama/wsgi.py diff --git a/chat/__init__.py b/chat/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/chat/__pycache__/__init__.cpython-312.pyc b/chat/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0f563879c0f65fca985aad29c285735b9db9acd4 GIT binary patch literal 151 zcmX@j%ge<81j^gf(?IlN5P=Rpvj9b=GgLBYGWxA#C}INgK7-W!GSkn<&rQ|O%P-2; zcgasK%}vcKDb_E~FG>NDsY&|zIXQ{BiTcSIi6#2+@tJvu*uC&Da}c>E8+l}!3e~~AjSt~ OMn=Ya3<^bTKn?)RhA_VX literal 0 HcmV?d00001 diff --git a/chat/__pycache__/apps.cpython-312.pyc b/chat/__pycache__/apps.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..705ef2f6ee7262d78899aae2ac2c09a6884b7142 GIT binary patch literal 453 zcmXv~Jx{|h5IrX;D*ZrEA*2or2ni`mEHN=4q|yqu{(vl&TRUly6Nh{Vl?|yQ16zLs z;s@{}SQx8FOiXM@fu$365^lJA=XcNcy|-?+1uBkTeeY4#Pu=`SqXxx^0xMv^kbnTW z2!R3Dz>Fm@lcN{2nsbeXWjDTbW21a~5Jf{7dUJnT(N#uuQ|v3S0uC->;2I3MCNo@X zVcJ&S8qR21Y3~o&4Gn$iu!$2$#zo>>&iz4_%BwjSEVrg=bZj^BCLtjWI3an95H*nNnk8zJ?A|+JmiC0~qxo0T!w>GDECIgN`8B08p(=6a&n&3MbGnM%SOCe}L zv3?WNC`z1Y5o?pmWGRqzRa(NjfA(%2tlN7JqgbDm{Ma`0cD;=j$J(|^-qENW+)-%L hJg*kGh<8=19ZR%Z-zGxn1CD;S4Agt-|AH!|>JM?kanS$( literal 0 HcmV?d00001 diff --git a/chat/__pycache__/models.cpython-312.pyc b/chat/__pycache__/models.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d91a50733c1edf4e4138a5528594cfd90bc7870d GIT binary patch literal 192 zcmX@j%ge<81j^gf(=37XV-N=hn4pZ$0zk%eh7^Vr#vF!R#wbQchDs()=9eI8O~zYn zx%nxnImLdOOt&~wvJ&&s^Yv1aikN|tD;Yk6)ci8h&&bbB)z8Z>%GYq)u@j)l2;!^3>$)vUP4(HsPbM8mpi^V*!@$(j*JzD;D#WKAAWZJRGJ>Y=D2uK(} z2sq+6LJ|iU0t5u)8G+l`W#fuDdG%iKqMrMF>zi*}d0fV`D_@8Lub->t$4;oiG}B>8 za|{;+Id6%cNkK|lF&7t3j+qpf#E6*Fbj{I;6vnVn998|az}qYiRjsQdqun9e{Yn!D zzJr{Fv|wesB@sF{&tPhwz-*f~l@v5qTG2z*=t>bMhW3=^7R4!5QN$#pjV4Q|n_lbm zXW4zJcsCLUx@1SVlg+M$35F1kz{Uuy|9SxX1AV=7TfeD491qdf7xD(ZJMvkse3UCs Rn?tlWA-IID3c6@p{{WO#W7q%y literal 0 HcmV?d00001 diff --git a/chat/__pycache__/views.cpython-312.pyc b/chat/__pycache__/views.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..518487b31d11177b7d9716c9b0606712e200491e GIT binary patch literal 3162 zcmbVPO>7&-6`tjiT>dOYiKI>0GOdMeNg*wgkYr0Tp{TGW+e#ovZX_UxpoE~gBWY=p z%g!z>iCL;CP@p>WAfMEt3BscS=isA`0ovFKdfBZgkliRifF6n-3MjTw6wakHE3Qd9 zZro-7zW3(Myf@!_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@#B~)L99CgqT>+Wvn7KUJ`IA{s`2Ww%=_0YU6h&|H5?FgJ-vu zdrB?Xrv>|VocqDSP4-(~Vw3qcG*Ukk`_4xDU7O623k1*CPxL(RhMZ;UFxb6azE`fi z`(WgYo7Ld-=2V>x)Yu-4?WwYThir!$=&h{P`bM)BqJ_a_==`HJFSNErh-zO^ke%HkZ&-~58s!V_9xLJjoP{axE*_r@yr9ovCF_Se9vBR6*Ov<(Ef%4sz^ zUW-m@(aHVj4VAmO@1IiHsiP~v!TtMb0N3b1l9iWU3qs&ja*l`8+%gKKX<^+wc1BCZ-m(Y z+`u_onXC+}zDSk5XqfNJ?oRFwtC4FeH?cQS_1`*RZ?#$vY2G0cCEi6Gblx-eUSdLpTeCl2RTe1`nqq7&<_WQ=HUp@JPLN-9HSo% z6V0PBqS-rhwd1WJ`l~2WeKlmmH0;pZ`AjOmEXE}KM#|};EFt_!3UqfvO`c@qwj=U& zV!Q#y$F6ZBJ_CsSDKIX~GshTyF^gF^j;>%G`3{wc$q`La)HmS#H{in8!230DKekd- N?1}v%Ri+H<{{V-2=~4gy literal 0 HcmV?d00001 diff --git a/chat/admin.py b/chat/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/chat/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/chat/apps.py b/chat/apps.py new file mode 100644 index 0000000..2fe899a --- /dev/null +++ b/chat/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class ChatConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'chat' diff --git a/chat/migrations/__init__.py b/chat/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/chat/migrations/__pycache__/__init__.cpython-312.pyc b/chat/migrations/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9e4636894c4eb550f1f112ab34d3e009bba73453 GIT binary patch literal 162 zcmX@j%ge<81j^gf(?IlN5P=Rpvj9b=GgLBYGWxA#C}INgK7-W!a@5br&rQ|O%P-2; zcgasK%}vcKDb_E~FG>NDsY&|zIXQ{BiTcSIi6#2EndwD|C7Jno#rpB_nR%Hd@$q^E imA^P_a`RJ4b5iY!Sb-)o0&y{j@sXL4k+Fyw$N~VX5h!T@ literal 0 HcmV?d00001 diff --git a/chat/models.py b/chat/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/chat/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/chat/templates/chat/index.html b/chat/templates/chat/index.html new file mode 100644 index 0000000..88ac321 --- /dev/null +++ b/chat/templates/chat/index.html @@ -0,0 +1,133 @@ + + + + + + + Chat with Ollama + + + + +
+

Chat with Ollama

+
+ {% csrf_token %} + + +
+ +
+
+ + + + + \ No newline at end of file diff --git a/chat/tests.py b/chat/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/chat/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/chat/urls.py b/chat/urls.py new file mode 100644 index 0000000..ece36c3 --- /dev/null +++ b/chat/urls.py @@ -0,0 +1,7 @@ +from django.urls import path +from . import views + +urlpatterns = [ + path('', views.index, name='index'), + path('send/', views.send_message, name='send_message'), +] \ No newline at end of file diff --git a/chat/views.py b/chat/views.py new file mode 100644 index 0000000..9bac006 --- /dev/null +++ b/chat/views.py @@ -0,0 +1,52 @@ +from django.shortcuts import render +from django.http import JsonResponse +import requests +import json + +def index(request): + return render(request, 'chat/index.html') + +def send_message(request): + if request.method == 'POST': + user_message = request.POST.get('message') + + api_url = 'http://192.168.1.36:11434/api/generate' # Updated URL with the correct port + headers = { + 'Authorization': 'Bearer your_api_key_here', # Include your API key if needed + 'Content-Type': 'application/json' + } + payload = { + 'prompt': user_message, + 'model': 'mistral:latest' # Include the model + } + + try: + response = requests.post(api_url, json=payload, headers=headers) + response.raise_for_status() # This will raise an HTTPError for bad responses + print(f'Response Content: {response.content}') + + # Handle the response correctly by splitting lines and parsing each JSON object + response_lines = response.content.decode('utf-8').splitlines() + combined_response = "" + for line in response_lines: + json_obj = json.loads(line) + if 'response' in json_obj: + combined_response += json_obj['response'] + " " + if json_obj.get('done', False): + break + + return JsonResponse({'response': combined_response.strip()}) + except requests.exceptions.HTTPError as errh: + print(f'HTTP Error: {errh}') + print(f'Response Content: {response.content}') + return JsonResponse({'error': f'HTTP Error: {errh}', 'details': response.content.decode('utf-8')}, status=400) + except requests.exceptions.ConnectionError as errc: + print(f'Error Connecting: {errc}') + return JsonResponse({'error': f'Error Connecting: {errc}'}, status=500) + except requests.exceptions.Timeout as errt: + print(f'Timeout Error: {errt}') + return JsonResponse({'error': f'Timeout Error: {errt}'}, status=500) + except requests.exceptions.RequestException as err: + print(f'Request Error: {err}') + print(f'Response Content: {response.content}') + return JsonResponse({'error': f'Request Error: {err}', 'details': response.content.decode('utf-8')}, status=500) diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..851c8cb6f18728ff8b7c77ebe776b99589e38a68 GIT binary patch literal 131072 zcmeI5Ym6h=RmWZJvfb{sefv4pWTvOxp6%T+Jw081w`U1#?`&tLv$H+B^I$U)QBk(5 zdpz-@$9B&{kr3|8CS()%kSLKrg5?Vm2tI_D@*zY*AcO!x03}E~g5c8vQV0S;K0qYS zy{>YV?P_$&*g(>^ZD{+G)roj(VO<2VR_00@8p2!H?xfB*=9 z00@8p2!Oy3p1|yMn3PV9zv*Fr%)ZDW{RF zQQK+Vb=8!}r`J-iOpvB4mZpTZw_DO%hPKoxc(xCAUo_YToHkML(K9$!sE%%Y7(Jif&qp)|`qso+EHcrW46* z=JgQi`KYBQXX<&NSIWev-e_uisiYZ=M!lg`sp<3`qv?hynI!KL>*J(s(^8hz8pi#- za>LMy^;*lQwOWsNjiyE|pLA8BrW0!Z)iF}>x}_rH^h*G$)OX4?t+rQj?KO#fBA3a& z5+of~TdQfOjxL+}Zp+n?L@trfCNGbY2CJ>rlv9II)ytJbx?CcYN~V)n1Ej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go_|uV)oXU5 zP^#5I1OljznjP6HQDFzQ>$&4t9kwzQ!Ie84D}Z;GNsK1v&r(ga-Idi!WPSOWhj|Y z0}?JQKP=e+XIAGR^Ex2soalBc&u%b{Vx0%%GQUw^i}_!P56S{Kx zwt#xYG_p>0!4o&L!}1;v4%OW>A)aHB<3K|2ytcgfJo`LfQx?t_~}XM literal 0 HcmV?d00001 diff --git a/ollama/__pycache__/urls.cpython-312.pyc b/ollama/__pycache__/urls.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0dfb95d18274f472df226fc34b52563123fd021d GIT binary patch literal 438 zcmY+Au};G<6h-aCNm@#a!~!cqP(?`f0z#?~U6}cRY-w!TRIyz-iJ;xsI?^fp0_s;V zGj_rY0~1?O#Xu+Qwi$TCz3&~{*RtR0^&Ox~z4q>YwSStSEN|N^A9Pay0tie1g8_u5 zw-Srlfz42WAg}_OiS%EileecU)A1Ws# zEatwY&@jyU%8PlFW3K~SB7r;)+eK&EnWN)(RGA!1 Vo6l$S{nI&WE*yK$daOzFnSZJSYzF`U literal 0 HcmV?d00001 diff --git a/ollama/__pycache__/wsgi.cpython-312.pyc b/ollama/__pycache__/wsgi.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9948dca5bd29641b4fa5eaeeb9b0c98d834e5df6 GIT binary patch literal 639 zcmYjPPiqrF6rb6RP1)EeVhi2|@e0D14)6Wmyg$F+8|Ks2mWS-Q^)Z^f#R&Z>g6h=H z!Fp`Ld&JQYam*cohuC^oIEg!SF#tXeMotZ{)W#B2P@u~SAEISAb2^VD!-<+L^q zzj?0*-5v>*oWv2CsEjBfSi(q}sTqXE_q?7V@FrCnG%-^kWj(W1V*!L|!bqa{T);g6 z3lL<%viK||SpuAlMl4N595NFtIU3n{&n!uzG9aD;t13B-!Bkw!f{*1OycKnm}?pO5m QXY=-#=AENPcGWih2LeF4g#Z8m literal 0 HcmV?d00001 diff --git a/ollama/asgi.py b/ollama/asgi.py new file mode 100644 index 0000000..ed20efe --- /dev/null +++ b/ollama/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for ollama project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ollama.settings') + +application = get_asgi_application() diff --git a/ollama/settings.py b/ollama/settings.py new file mode 100644 index 0000000..072dd8b --- /dev/null +++ b/ollama/settings.py @@ -0,0 +1,124 @@ +""" +Django settings for ollama project. + +Generated by 'django-admin startproject' using Django 5.0.6. + +For more information on this file, see +https://docs.djangoproject.com/en/5.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/5.0/ref/settings/ +""" + +from pathlib import Path + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-b%0==p)98(5sa=z&jx=llq=p!(+3pp4_x410g5j$40ifay-ljq' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'chat', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'ollama.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'ollama.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/5.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/5.0/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/5.0/howto/static-files/ + +STATIC_URL = 'static/' + +# Default primary key field type +# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/ollama/urls.py b/ollama/urls.py new file mode 100644 index 0000000..99c9c9b --- /dev/null +++ b/ollama/urls.py @@ -0,0 +1,9 @@ +# myproject/urls.py + +from django.contrib import admin +from django.urls import path, include # Import 'include' + +urlpatterns = [ + path('admin/', admin.site.urls), + path('chat/', include('chat.urls')), # Include the URLs from the 'chat' app +] diff --git a/ollama/wsgi.py b/ollama/wsgi.py new file mode 100644 index 0000000..d247f02 --- /dev/null +++ b/ollama/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for ollama project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ollama.settings') + +application = get_wsgi_application()