From e4f2a60fd6fc70ae974b7301dd58c383d2fc6854 Mon Sep 17 00:00:00 2001 From: walterbm-cohere Date: Sun, 3 Dec 2023 00:50:47 -0500 Subject: [PATCH] rename template connector --- .gitignore | 1 + {template => _template_}/.env-template | 0 {template => _template_}/README.md | 0 {template => _template_}/poetry.lock | 0 {template => _template_}/provider/__init__.py | 2 +- {template => _template_}/provider/app.py | 24 ++++++++++++++++--- {template => _template_}/pyproject.toml | 0 7 files changed, 23 insertions(+), 4 deletions(-) rename {template => _template_}/.env-template (100%) rename {template => _template_}/README.md (100%) rename {template => _template_}/poetry.lock (100%) rename {template => _template_}/provider/__init__.py (91%) rename {template => _template_}/provider/app.py (59%) rename {template => _template_}/pyproject.toml (100%) diff --git a/.gitignore b/.gitignore index e291f4295..f9c75738a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .vscode/ **/dev/data/ *.pyc +.trunk/ .DS_Store milvus/volumes/ diff --git a/template/.env-template b/_template_/.env-template similarity index 100% rename from template/.env-template rename to _template_/.env-template diff --git a/template/README.md b/_template_/README.md similarity index 100% rename from template/README.md rename to _template_/README.md diff --git a/template/poetry.lock b/_template_/poetry.lock similarity index 100% rename from template/poetry.lock rename to _template_/poetry.lock diff --git a/template/provider/__init__.py b/_template_/provider/__init__.py similarity index 91% rename from template/provider/__init__.py rename to _template_/provider/__init__.py index d157cbdaa..0558e5ece 100644 --- a/template/provider/__init__.py +++ b/_template_/provider/__init__.py @@ -27,6 +27,6 @@ def create_app() -> connexion.FlaskApp: logging.basicConfig(level=logging.INFO) flask_app = app.app # load environment variables prefixed with the name of the current directory - config_prefix = os.path.split(os.getcwd())[1].upper() + config_prefix = os.path.split(os.getcwd())[1].upper().replace("_", "") flask_app.config.from_prefixed_env(config_prefix) return flask_app diff --git a/template/provider/app.py b/_template_/provider/app.py similarity index 59% rename from template/provider/app.py rename to _template_/provider/app.py index 7ad7fb0d8..41d4a8f4a 100644 --- a/template/provider/app.py +++ b/_template_/provider/app.py @@ -18,11 +18,29 @@ def search(body): # - a url field that points to the source of the data data = [ { - "id": "0", + "id": "1", "title": "Tall penguins", - "text": "Emperor penguins are the tallest", + "text": "The tallest penguin is the Emperor penguin", "url": "https://en.wikipedia.org/wiki/Penguin", - } + }, + { + "id": "2", + "title": "Emperor penguins", + "text": "The latin name for Emperor penguin is Aptenodytes forsteri", + "url": "https://en.wikipedia.org/wiki/Penguin", + }, + { + "id": "3", + "title": "Small penguins", + "text": "The smallest penguin is the fairy penguin", + "url": "https://en.wikipedia.org/wiki/Penguin", + }, + { + "id": "4", + "title": "Eudyptula penguis", + "text": "The latin name for fairy penguin is Eudyptula minor", + "url": "https://en.wikipedia.org/wiki/Penguin", + }, ] return {"results": data} diff --git a/template/pyproject.toml b/_template_/pyproject.toml similarity index 100% rename from template/pyproject.toml rename to _template_/pyproject.toml