Skip to content

Catalyst-ALT/Catalyst-AI-BE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Catalyst OpenAI Integration Project BE README

https://catalyst-alt.netlify.app/
Project Summary https://catalyst-alt.github.io/catalyst-project-summary/

Framework

  • Django Rest-Framework

Database

  • Postgresql@14

Token Authentication System

Deployment


Run Locally

Clone the project:

git clone https://github.com/Catalyst-ALT/Catalyst-AI-BE.git

Navigate to the project directory:

cd Catalyst-AI-BE

Install a virtual environment:

pip install pipenv

Run the virtual environment:

pipenv shell

Install dependencies:

pipenv install

Set up a local database:

python manage.py migrate

Start the local server:

python manage.py runserver

Endpoints

CREATE USER

https://catalyst-x226.onrender.com/auth/users/

request

POST  auth/users/
    {
    "username": "superuser",
    "password": "somepassword"
    }

response

HTTP_201_created
    {
    "username": "superuser",
    "password": "somepassword",
    }


LOGIN

https://catalyst-x226.onrender.com/auth/token/login/

Token Create

request

POST auth/token/login/
    {
    "username": "superuser",
    "password": "somepassword"
    }

response

HTTP_200_OK
    {
    "auth_token": "somereallylonglistofnumbersandletters"
    }


LOGOUT

https://catalyst-x226.onrender.com/auth/token/logout/

Token Destroy

request

POST auth/token/logout/

response

HTTP_204_NO_CONTENT


PROFILE

https://catalyst-x226.onrender.com/api/profile/username/

request

GET api/profile/<username>/

response

    {
    "username": "superuser",
    }

request

PATCH  api/profile/<username>/

response

    {
    "username": "superuser"
    },

request

DELETE  api/profile/<username>/

response

HTTP_204_NO_CONTENT


WRITE INSTANCE CREATE

https://catalyst-x226.onrender.com/api/write/generate/

POST api/write/generate/

Purpose:

  • Creates Write instance
  • Generates opeanai prompt output
  • Sends info to DB for call to openai
  • Creates a note associated with this instance with empty string as default
  • Creates an id for this instance
  • Auto adds 'created_at' date/time
  • Adds field 'input_length' for call to api
    {
    "style": "poetry",
    "theme": "emotion",
    "category": "relationships and love",
    "sentiment": "harmony",
    "emotion": "joy",
    "prompt_length": "prompt",
    }

Required Fields: 'style', 'theme', 'category', 'sentiment', 'emotion', 'prompt_length'



WRITE SINGLE INSTANCE RETRIEVE

https://catalyst-x226.onrender.com/api/response/write/id

GET api/response/write/id

Purpose:

  • Retrieves single Write instance
  • Retrieves the id for this instance
  • Retrieves the note associated with this instance
  • Retrieves from DB opeanai prompt output
  • Retrieves 'created_at' date/time for this instance
    {
    "id": 104,
    "style": "poetry",
    "theme": "emotion",
    "category": "relationships and love",
    "sentiment": "harmony",
    "emotion": "joy",
    "prompt_length": "prompt",
    "input_length": "Let the prompt be 20-25 words",
    "output": "Write a story about two souls who find solace in each other's presence, navigating the complexities of their emotions and forging a bond that radiates harmony, joy, and profound love.",
    "created_at": "2023-07-19T21:49:42.927227Z",
    "user": 1,
    "note": ""
    }

New Fields: 'id', 'input_length', 'output', 'user', 'note', 'created_at'

WRITE INSTANCE UPDATE
https://catalyst-x226.onrender.com/api/response/write/id

PATCH api/response/write/id

Purpose

  • Allows user to update their note associated with this instance


RETRIEVE ALL WRITE INSTANCES

https://catalyst-x226.onrender.com/write/

GET api/write/

Purpose

  • Retrieves list of user Write instances
  • Retrieves all openai outputs for the collection of user Write instances
  • Retrieves all notes for the collection of user Write instances
    [
	{
	"id": 67,
	"style": "creative writing",
	"theme": "nature",
	"category": "relationships and love",
	"sentiment": "harmony",
	"emotion": "joy",
	"prompt_length": "prompt",
	"input_length": "Let the prompt be 20-25 words",
	"output": "",
	"created_at": "2022-08-07T00:00:00Z",
	"user": 1,
	"note": ""
	},
	{
	"id": 80,
	"style": "poetry",
	"theme": "emotion",
	"category": "relationships and love",
	"sentiment": "harmony",
	"emotion": "joy",
	"prompt_length": "prompt",
	"input_length": "Let the prompt be 20-25 words",
	"output": "Explore the captivating tale of two souls intertwined, braving the trials of life together, where profound connections overcome all obstacles, paving the way for boundless euphoria.",
	"created_at": "2023-07-19T00:48:55.149209Z",
	"user": 1,
	"note": ""
	},
    ]


VISUAL ART INSTANCE CREATE

https://catalyst-x226.onrender.com/api/visual_art/generate/

POST api/visual_art/generate/

Purpose:

  • Creates VisualArt Instance
  • Generates opeanai prompt output
  • Sends info to DB for call to openai
  • Creates a note associated with this instance with empty string as default
  • Creates an id for this instance
  • Auto adds 'created_at' date/time
  • Adds 'input_length" for call to api
    {
    "medium": "painting",
    "theme": "texture",
    "sentiment": "renewal",
    "emotion": "joy",
    "prompt_length": "one word", 
    }

Required Fields: 'medium', 'theme', 'sentiment', 'emotion', 'prompt_length'

VISUAL ART SINGLE INSTANCE RETRIEVE

https://catalyst-x226.onrender.com/api/response/visual_art/id

GET api/response/visual_art/id

Purpose:

  • Retrieves single VisualArt instance
  • Retrieves the id for this instance
  • Retrieves the note associated with this instance
  • Retrieves opeanai prompt output
  • Retrieves 'created_at' date/time for this instance
    {
	"id": 70,
	"medium": "painting",
	"theme": "texture",
	"sentiment": "renewal",
	"emotion": "joy",
	"prompt_length": "one word",
	"input_length": "Let the prompt be only 1 word",
	"output": "Burst",
	"created_at": "2023-07-19T21:59:42.298361Z",
	"user": 1,
	"note": ""
}

New Fields: 'id', 'input_length', 'output', 'user', 'note', 'created_at'

VISUAL ART INSTANCE UPDATE
https://catalyst-x226.onrender.com/api/response/visual_art/id

PATCH api/response/visual_art/id

Purpose

  • Allows user to update their note associated with this instance


RETRIEVE ALL VISUAL ART INSTANCES

https://catalyst-x226.onrender.com/visual_art/

GET api/visual_art/

Purpose

  • Retrieves list of user Visual Art instances
  • Retrieves all openai outputs for the collection of user Visual Art instances
  • Retrieves all notes for the collection of user Visual Art instances
    ]
        {
	"id": 69,
	"medium": "painting",
	"theme": "texture",
	"sentiment": "renewal",
	"emotion": "joy",
	"prompt_length": "prompt",
	"input_length": "Let the prompt be 20-25 words",
	"output": "Create a vibrant masterpiece that captures the essence of growth and happiness through the interplay of various tactile elements.",
	"created_at": "2023-07-19T21:59:29.054715Z",
	"user": 1,
	"note": ""
	},
	{
	"id": 70,
	"medium": "painting",
	"theme": "texture",
	"sentiment": "renewal",
	"emotion": "joy",
	"prompt_length": "one word",
	"input_length": "Let the prompt be only 1 word",
	"output": "Burst",
	"created_at": "2023-07-19T21:59:42.298361Z",
	"user": 1,
	"note": ""
	}
    ]


MOVEMENT INSTANCE CREATE

https://catalyst-x226.onrender.com/api/movement/generate/

POST api/movement/generate/

Purpose:

  • Creates Movement instance
  • Generates opeanai prompt output
  • Sends info to DB for call to openai
  • Creates a note associated with this instance with empty string as default
  • Creates an id for this instance
  • Auto adds 'created_at' date/time
  • Adds 'input_length" for call to api
    {
    "theme": "spatial awareness",
    "somatic": "breath and movement",
    "sentiment": "harmony",
    "emotion": "joy",
    "prompt_length": "one word",
    }

Required Fields: 'theme', 'somatic', 'emotion', 'prompt_length'

MOVEMENT SINGLE INSTANCE RETREIVE

https://catalyst-x226.onrender.com/api/response/movement/id

GET api/response/movement/id

Purpose:

  • Retrieves single Movement instance
  • Retrieves the id for this instance
  • Retrieves the note associated with this instance
  • Retrieves opeanai prompt output
  • Retrieves 'created_at' date/time for this instance
    {
    "id": 9,
    "theme": "spatial awareness",
    "somatic": "breath and movement",
    "sentiment": "harmony",
    "emotion": "joy",
    "prompt_length": "one word",
    "input_length": "Let the prompt be only 1 word",
    "output": "Flow",
    "created_at": "2023-07-19T22:02:43.640107Z",
    "user": 1,
    "note": ""
    }

New Fields: 'id', 'input_length', 'output', 'user', 'note', 'created_at'

MOVEMENT INSTANCE UPDATE
https://catalyst-x226.onrender.com/api/response/movement/id

PATCH api/response/movement/id

Purpose

  • Allows user to update their note associated with this instance


RETRIEVE ALL MOVEMENT INSTANCES

https://catalyst-x226.onrender.com/movement/

GET api/movement/

Purpose

  • Retrieves list of user Movement instances
  • Retrieves all openai outputs for the collection of user Write instances
  • Retrieves all notes for the collection of user Write instances
    [
        {
	"id": 8,
	"theme": "spatial awareness",
	"somatic": "breath and movement",
	"sentiment": "harmony",
	"emotion": "joy",
	"prompt_length": "prompt",
	"input_length": "Let the prompt be 20-25 words",
	"output": "Explore the limitless expanse within, unleashing a symphony of fluidity and grace, as you dance with boundless delight, embracing the interconnectedness of body and space.",
	"created_at": "2023-07-19T22:02:15.049638Z",
	"user": 1,
	"note": ""
	},
	{
	"id": 9,
	"theme": "spatial awareness",
	"somatic": "breath and movement",
	"sentiment": "harmony",
	"emotion": "joy",
	"prompt_length": "one word",
	"input_length": "Let the prompt be only 1 word",
	"output": "Flow",
	"created_at": "2023-07-19T22:02:43.640107Z",
	"user": 1,
	"note": ""
	}
    ]


MUSIC CREATE INSTANCE

https://catalyst-x226.onrender.com/api/music/generate/

POST api/music/generate/

Purpose:

  • Create Music instance
  • Generates opeanai prompt output
  • Sends info to DB for call to openai
  • Creates a note associated with this instance with empty string as default
  • Creates an id for this instance
  • Auto adds 'created_at' date/time
  • Adds 'input_length" for call to api
    {
    "exploration": "genre fusion",
    "concept": "dynamics",
    "element": "fire",
    "emotion": "courage",
    "prompt_length": "one word",
    }

Required Fields: 'exploration', 'concept', 'emotion', 'element', 'prompt_length'

MUSIC SINGLE INSTANCE RETRIEVE

https://catalyst-x226.onrender.com/api/response/music/id

GET api/response/music/id

Purpose:

  • Retrieves a single Music instance
  • Retrieves the id for this instance
  • Retrieves the note associated with this instance
  • Retrieves opeanai prompt output
  • Retrieves 'created_at' date/time for this instance
    {
    "id": 30,
    "exploration": "genre fusion",
    "concept": "dynamics",
    "element": "fire",
    "emotion": "courage",
    "prompt_length": "one word",
    "input_length": "Let the prompt be only 1 word",
    "output": "Ignite",
    "created_at": "2023-07-19T22:04:30.480555Z",
    "user": 1,
    "note": ""
    }

New Fields: 'id', 'input_length', 'output', 'user'(user_id), 'note', 'created_at'

MUSIC INSTANCE UPDATE
https://catalyst-x226.onrender.com/api/response/music/id

PATCH api/response/music/id

Purpose

  • Allows user to update their note associated with this instance


RETRIEVE ALL MUSIC INSTANCES

https://catalyst-x226.onrender.com/music/

GET api/music/

Purpose

  • Retrieves list of user Music instances
  • Retrieves all openai outputs for the collection of user Music instances
  • Retrieves all notes for the collection of user Music instances
[
    {
    "id": 34,
    "exploration": "genre fusion",
    "concept": "dynamics",
    "element": "fire",
    "emotion": "courage",
    "prompt_length": "prompt",
    "input_length": "Let the prompt be 20-25 words",
    "output": "Create an electrifying sonic journey that seamlessly blends diverse genres, igniting the listener's spirit with bold dynamics and invoking a sense of fearless passion.",
    "created_at": "2023-07-19T22:08:35.122715Z",
    "user": 1,
    "note": "Art is life"
    },
    {
    "id": 29,
    "exploration": "genre fusion",
    "concept": "dynamics",
    "element": "fire",
    "emotion": "courage",
    "prompt_length": "one word",
    "input_length": "Let the prompt be only 1 word",
    "output": "Ignite",
    "created_at": "2023-08-07T00:00:00Z",
    "user": 1,
    "note": "I love this app"
    },
]


FOLIOS

https://catalyst-x226.onrender.com/api/folios/

GET api/folios/

Purpose

  • Retrieves list of all instances (Write, Music, VisualArt, Movement) associated with user
  • Retrieves list of notes associated with user (Write notes, Music notes, VisualArt notes, Movement notes), including any notes the user has updated
  • Retrieves list of all openai api prompt outputs (Write output, Music output, VisualArt output, Movement output)
[
    {
    "username": "superuser",
    }
    "music": [
        {
        "id": 2,
        "exploration": "musical time travel",
        "concept": "tempo",
        "element": "fire",
        "emotion": "joy",
	"prompt_length": "prompt",
	"input_length": "Let the prompt be 20-25 words",
	"output": "Journey through melodic epochs fuelled by celebratory rhythms, kindling a passionate storm. Create harmonies that transport listeners through a timeless musical dimension.",
        "user": 1,
        "note": ""
	},
    ],
    "visual_arts": [
	{
	"id": 25,
	"medium": "painting",
	"theme": "texture",
	"sentiment": "renewal",
	"emotion": "joy",
	"prompt_length": "prompt",
	"input_length": "Let the prompt be 20-25 words",
	"output": "Create a vibrant masterpiece capturing the essence of transformation and delight, where layered brushstrokes evoke both tactile and emotional sensations.",
	"user": 1,
    "note": "", 
	},
    ],
    "movements": [
	{
	"id": 5,
	"theme": "spatial awareness",
	"somatic": "breath and movement",
	"sentiment": "harmony",
	"emotion": "joy",
	"prompt_length": "prompt",
	"input_length": "Let the prompt be 20-25 words",
	"output": "Create a dynamic dance piece that explores the seamless interplay of bodies in space, flowing breath, and expressive movements, evoking a sense of pure and radiant bliss.",
	"user": 1,
    "note": ""
        },	
    ],
    "writes": [
	{
        "id": 66,
        "style": "word play",
        "theme": "emotion",
        "category": "relationships and love",
        "sentiment": "renewal",
        "emotion": "joy",
        "prompt_length": "one word",
        "input_length": "Let the prompt be only 1 word",
        "output": "Spark",
        "user": 1,
        "note": ""
        },
    ]
]

WELCOME PROMPT GENERATE

https://catalyst-x226.onrender.com/api/welcome/generate/

POST api/welcome/generate/

Purpose:

  • Triggers call to openai's api to generate welcome message

Required Fields: none"



RETRIEVE WELCOME MESSAGE

https://catalyst-x226.onrender.com/api/welcome/id

GET api/welcome/id

Purpose:

  • Retrieves welcome output/message from DB
    {
    "id": 3,
    "output_text": "Welcome to the app! How can I assist you today?"
    }

New Fields: 'id', 'output_text"

DEFINITION GENERATE
https://catalyst-x226.onrender.com/api/definition/generate/

POST api/definition/generate/

Purpose:

  • Sends word (to be defined) to DB for call to openai's api
    {
    "word": "gracious"
    }

Required Field: "word"

RETRIEVE DEFINITION

https://catalyst-x226.onrender.com/api/definition/id

GET api/definition/id

Purpose

  • Retrieves output/definition from DB
    {
    "id": 7,
    "word": "gracious",
    "definition": "Gracious means being kind, polite, and showing good manners towards others. It is when someone behaves in a considerate and generous way, making others feel valued and respected.",
    "antonym": "An antonym for the word gracious is rude or ungracious.",
    "synonym": "A synonym for the word gracious is courteous.",
    "sentence": "The hostess greeted her guests with a gracious smile and warm welcome.",
    "joke": "Why did the polite computer say gracious all the time? Because it had impeccable netiquette",
    "color": "The color associated with the word gracious is a warm and inviting shade of golden yellow, reminiscent of a radiant sunset, exuding kindness and elegance."
    }

New Fields: 'id', 'definition'

USER NOTEBOOK (ALL PROMPTS W/ NOTES)
https://catalyst-x226.onrender.com/api/notebook/

GET api/notebook/

Purpose

  • Filters for the prompts the user has written notes on
  • Retrieves a list
    {
    "id": 104,
    "user": 1,
    "style": "poetry",
    "theme": "emotion",
    "category": "relationships and love",
    "sentiment": "harmony",
    "emotion": "joy",
    "prompt_length": "prompt",
    "input_length": "Let the prompt be 20-25 words",
    "created_at": "2023-07-19T21:49:42.927227Z",
    "output": "Write a story about two souls who find solace in each other's presence, navigating the complexities of their emotions and forgin
    a bond that radiates harmony, joy, and profound love.",
    "note": "take notes",
    "save": null
    },

USER SAVED PROMPTS
https://catalyst-x226.onrender.com/api/prompts/saved/

GET api/prompts/saved/

USER UPLOAD FILE (IMAGE, ETC.)
https://catalyst-x226.onrender.com/api/upload/create/

POST api/upload/create/

Purpose

  • For user to upload files (images, videos, etc) to app


GET SINGLE USER FILE UPLOAD (IMAGE, ETC.)
https://catalyst-x226.onrender.com/api/upload/id

GET api/uploads/id

Purpose

  • To retrieve and display a single file the user has uploaded (for example an image to be diplayed in the folios section)


GET A LIST OF USER FILE UPLOADS
https://catalyst-x226.onrender.com/api/uploads/

GET api/uploads/

Purpose

  • To retrieve and display a list of files the user had uploaded (for example a list of images to be displayed in the folios section)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published