diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index bff8387..1ce5c7e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -19,7 +19,6 @@ // Set *default* container specific settings.json values on container create. "settings": { "[python]": { - "defaultInterpreterPath": "/opt/conda/envs/myenv/bin/python", "editor.formatOnType": true, "editor.formatOnSave": true } diff --git a/.well-known/ai-plugin.json b/.well-known/ai-plugin.json index 2eeab96..e035612 100644 --- a/.well-known/ai-plugin.json +++ b/.well-known/ai-plugin.json @@ -1,9 +1,9 @@ { "schema_version": "v1", - "name_for_human": "TODO app", - "name_for_model": "TODO_APP", - "description_for_human": "Todo app for managing your tasks", - "description_for_model": "Todo app for managing your tasks", + "name_for_human": "My app", + "name_for_model": "my_app", + "description_for_human": "This app is", + "description_for_model": "This app is", "auth": { "type": "user_http", "authorization_type": "bearer" diff --git a/.well-known/logo.png b/.well-known/logo.png index 5bffb38..0f237a2 100644 Binary files a/.well-known/logo.png and b/.well-known/logo.png differ diff --git a/.well-known/openapi.yaml b/.well-known/openapi.yaml deleted file mode 100644 index d043e2c..0000000 --- a/.well-known/openapi.yaml +++ /dev/null @@ -1,82 +0,0 @@ -openapi: 3.0.2 -info: - title: OpenAI plugin for a simple todo app - description: Todo app for managing your tasks on ChatGPT - version: 1.0.0 - servers: - - url: https://your-app-url.com -paths: - /todos: - post: - summary: Create a new TODO item - description: Accepts a string and adds as new TODO item - operationId: create_todo - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/TodoItem" - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/TodoItem" - get: - summary: Get a list of all TODO items - operationId: list_todos - responses: - "200": - description: OK - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/TodoList" - /todos/{todo_id}: - get: - summary: Get a TODO item by ID - operationId: get_todo - parameters: - - name: todo_id - in: path - required: true - description: ID of the TODO item to retrieve - schema: - type: integer - format: int64 - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/TodoItem" - "404": - description: Todo not found - delete: - summary: Delete a TODO item by ID - operationId: delete_todo - parameters: - - name: todo_id - in: path - required: true - description: ID of the TODO item to delete - schema: - type: integer - format: int64 - responses: - "204": - description: Todo deleted - "404": - description: Todo not found -components: - schemas: - TodoItem: - type: object - properties: - title: - type: string \ No newline at end of file diff --git a/flush_db.py b/flush_db.py deleted file mode 100644 index 9b12b58..0000000 --- a/flush_db.py +++ /dev/null @@ -1,4 +0,0 @@ -import redis - -redis_client = redis.StrictRedis(host='0.0.0.0', port=6379, db=0, decode_responses=True) -redis_client.flushdb() \ No newline at end of file diff --git a/main.py b/main.py deleted file mode 100644 index e5ca87f..0000000 --- a/main.py +++ /dev/null @@ -1,47 +0,0 @@ -from fastapi import FastAPI, HTTPException -from fastapi.staticfiles import StaticFiles -import os -import redis - -redis_client = redis.StrictRedis(host='0.0.0.0', port=6379, db=0, decode_responses=True) - -app = FastAPI() -app.mount("/.well-known", StaticFiles(directory=".well-known"), name="static") - -# Route to list all TODOs -@app.get("/todos") -def list_todos(): - todos = {} - for key in redis_client.keys(): - if key != 'todo_id': - todos[key] = "["+key+"] "+str(redis_client.get(key)) - return todos - -# Route to list a specific TODO -@app.get("/todos/{todo_id}") -def list_todo(todo_id: int): - todo = redis_client.get(str(todo_id)) - if todo: - return {"todo_id": todo_id, "todo": todo} - else: - raise HTTPException(status_code=404, detail="Todo not found") - -# Route to add a TODO -@app.post("/todos") -def add_todo(todo: str): - # Generate a unique todo_id - todo_id = redis_client.incr('todo_id') - redis_client.set(str(todo_id), todo) - return {"todo_id": todo_id, "todo": todo} - -# Route to delete a TODO -@app.delete("/todos/{todo_id}") -def delete_todo(todo_id: int): - if not redis_client.exists(str(todo_id)): - raise HTTPException(status_code=404, detail="Todo not found") - redis_client.delete(str(todo_id)) - return {"result": "Todo deleted"} - -if __name__ == "__main__": - import uvicorn - uvicorn.run("main:app", host="0.0.0.0", port=8000, log_level="info") diff --git a/test_main.py b/test_main.py deleted file mode 100644 index b6a682d..0000000 --- a/test_main.py +++ /dev/null @@ -1,46 +0,0 @@ -import pytest -from fastapi.testclient import TestClient - -from main import app - - -@pytest.fixture -def client(): - return TestClient(app) - - -def test_list_todos_empty(client): - response = client.get("/todos") - assert response.status_code == 200 - assert response.json() == {} - - -def test_list_todo_not_found(client): - response = client.get("/todos/1") - assert response.status_code == 404 - assert response.json() == {"detail": "Todo not found"} - - -def test_add_todo(client): - response = client.post("/todos", params={"todo": "Buy groceries"}) - assert response.status_code == 200 - assert response.json() == {"todo_id": 1, "todo": "Buy groceries"} - - -def test_list_todo(client): - client.post("/todos", params={"todo": "Buy groceries"}) - response = client.get("/todos/1") - assert response.status_code == 200 - assert response.json() == {"todo_id": 1, "todo": "Buy groceries"} - - -def test_delete_todo(client): - response = client.delete("/todos/1") - assert response.status_code == 200 - assert response.json() == {"result": "Todo deleted"} - - -def test_delete_todo_not_found(client): - response = client.delete("/todos/1") - assert response.status_code == 404 - assert response.json() == {"detail": "Todo not found"} \ No newline at end of file