From 3081f4bc5b221f89585da35603cb1218e77dab1c Mon Sep 17 00:00:00 2001 From: kre8mymedia Date: Sun, 13 Aug 2023 01:15:37 -0500 Subject: [PATCH 1/2] Updates with pages --- README.md | 9 +++++++++ server/__pycache__/api.cpython-310.pyc | Bin 2073 -> 1970 bytes server/api.py | 21 +++++++-------------- static/pages/index.html | 4 +++- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index a6e223e..ccc16f9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,14 @@ # Prompt Engineers AI - Serverless Chat +### Useful Links +- [Blog Rocket - Deploying FastAPI to Vercel](https://blog.logrocket.com/deploying-fastapi-applications-to-vercel/) + +## Run development server +```bash +python main.py +``` + +## Deploy 1. Log in to vercel ```bash vercel login diff --git a/server/__pycache__/api.cpython-310.pyc b/server/__pycache__/api.cpython-310.pyc index 8886da07fa3a1b7073020ae8be5ee09bf1df147d..54cc46b23d7bfe596e39cacccf286216242b557b 100644 GIT binary patch delta 850 zcmYjPO>fgc5cRGdJ4qAU%~$CMQuwH-Rgoep^#oiHs^EguatcV1>)j--65CpDQClIE zs=ZdCmU0&UFSc#Pfgw32$R^hZyS(VwR#tG@pZfeY7?y1IHUOLgcHDK4- zEUQh}bzTE@gEez@gB7+luXX-ozU~p_JPD&+|L!wBPDZ}uX=ag)rZQ9M%P@fdB^C-E z$XFa?_sPl;0gWa+-{46b0LMgX9|x5+7{+7nQQ<%{RSEWl;F0Vh&7-O$|LRgMN}NNDTRctTDCHi>i!LCt|`6I38pAog@|8`GxX>E1{x!l$O@i>(GjU-o#!k{E=oWvkY5cLOV%%If=Y7Lrg< zh=q=QYLirFvN>Ti5Jo;g9wZp#%gsG0CI`%q;3NqP%ZmtivI}eRMGZe&2)J5hBr({B rGpDrub3_&IjbpYq;t%lrrAq*=R>@r{!e*PaLdwK0fJ6Sqy7A*LbAj-QHViP$LfB8W)F)bNAlz7 z0xdvvk(8q75{W%iD&-3)Qo$ne&<^eM|<0kcWK~zZa^VMT@U9_ zEws?>A%-js-kc}?=uXZN!^#hL##;L=Iwbpn+yG^f0P41b!F^3Nvi}h-!Hl^Y>_Bu{r z!oxe%Y8m}RACH$i9##kOU!kBiHxe5lGmoOKeX`2fr zX4-)B4)GU=h(+l0}=ClcrU*8 zG%8}Wh76H<@TN(9SpmBR>x#-&q&v=N(C>1A=#*;IY_{34xkX*#dr;Wj@JD>< z7Ks)dS=)D*Jd8}0JcY4q75Ji48?ac!&j-HawnyDYBT4!LV!PaFvZTyTNmvc&S?~bPC2y8T|vN|KrI3 diff --git a/server/api.py b/server/api.py index 7eb67e4..66316e7 100644 --- a/server/api.py +++ b/server/api.py @@ -1,31 +1,24 @@ from fastapi import FastAPI, Request -from fastapi.responses import HTMLResponse +from fastapi.templating import Jinja2Templates from typing import Any, Optional from pydantic import BaseModel, Field - import openai import os app = FastAPI() os.environ.get('OPENAI_API_KEY') +templates = Jinja2Templates(directory="static") ####################################################################### ### Pages ####################################################################### @app.get("/", tags=["Pages"]) async def chat_interface(request: Request): - html_content = """ - - - My HTML Page - - -

Welcome to my HTML page!

-

This is the content of my HTML page.

- - - """ - return HTMLResponse(content=html_content, status_code=200) + """Serves the index page.""" + return templates.TemplateResponse( + "pages/index.html", + {"request": request, "current_page": "home"} + ) ################################################# ## ChatGPT diff --git a/static/pages/index.html b/static/pages/index.html index 1233e55..1e0b696 100644 --- a/static/pages/index.html +++ b/static/pages/index.html @@ -31,8 +31,10 @@
-

Welcome to My Simple Index Page

+

Open AI Serverless Chat

This is a basic HTML page. You can add your content here and customize it as needed.

+ API Docs + Github
From e5711849ec22c36d775232f5d7cf50cb538e6e74 Mon Sep 17 00:00:00 2001 From: kre8mymedia Date: Sun, 13 Aug 2023 01:23:30 -0500 Subject: [PATCH 2/2] Updates --- .gitignore | 6 +++++- LICENSE | 21 +++++++++++++++++++++ README.md | 22 +++++++++++++++++++--- requirements-dev.txt | 3 +++ 4 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 LICENSE create mode 100644 requirements-dev.txt diff --git a/.gitignore b/.gitignore index 14fcadd..a3b71c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ +.env* +.env.local +__pycache__/ +.venv/ +.pytest_cache/ .vercel -.venv \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f2c0a38 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Ryan Eggleston + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index ccc16f9..8450372 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ -# Prompt Engineers AI - Serverless Chat +

+ 🤖 Prompt Engineers AI - Serverless Chat +

### Useful Links - [Blog Rocket - Deploying FastAPI to Vercel](https://blog.logrocket.com/deploying-fastapi-applications-to-vercel/) -## Run development server +## 🛠️ Setup and Usage ```bash python main.py ``` @@ -17,4 +19,18 @@ vercel login 2. Deploy to vercel ```bash vercel . -``` \ No newline at end of file +``` + +## 💡 Issues + +Feel free to submit issues and enhancement requests. We're always looking for feedback and suggestions. + +## 🤓 Maintainers + +- `Ryan Eggleston` - `ryan.adaptivebiz@gmail.com` + +## 📜 License + +This project is open-source, under the [MIT License](LICENSE). Feel free to use, modify, and distribute the code as you please. + +Happy Coding! 🎉🎉 \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..2c1768f --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,3 @@ +pytest +httpx +pytest-asyncio \ No newline at end of file