Giter VIP home page Giter VIP logo

tolkai_test's Introduction

Conversational Agent Application

Overview

This repository contains the code for a Conversational Agent Application, developed as part of a technical recruitment test for an alternant/developer position focusing on SaaS Fullstack development. The application is designed to store and retrieve conversations between users and chatbots.

Table of Contents

Functionalities

The application consists of two main parts:

  1. API:

    • Provides endpoints to retrieve conversations.
    • Allows listing the 20 most recent conversations.
    • Permits fetching all messages belonging to a specific conversation by its ID.
  2. Frontend Application:

    • Displays the 20 most recent conversations.
    • Allows users to view messages belonging to a specific conversation.

Each conversation includes:

  • Conversation ID
  • One or more messages (each with a text content)
  • Participants (bot and user)
  • Number of messages in the conversation
  • Conversation date

Results

The objective of this exercise is to implement a basic version of the application. The following results are expected:

  • Documentation for using the API.
  • Documentation for running both the API and Frontend projects locally.

Technologies Used

  • TypeScript
  • Express
  • ReactJS
  • PostgreSQL

Setup

Backend Setup

Prerequisites

Make sure you have Node.js and PostgreSQL installed on your machine.

Clone the project from GitHub:

git clone [email protected]:Drackass/Tolkai_test.git
cd Tolkai_test

Install dependencies

cd server
npm install

Database Configuration

  1. Create a PostgreSQL database with the name "tolkai" (or update the db.js file with your preferred name).
  2. Copy the contents of db_example.js into a new db.js file in the same directory.
  3. Fill in the connection information to your database in the db.js file.

Launch the server with file watching

tsc --watch
node --watch dist/index.js

The server should be accessible at http://localhost:5000.

Frontend Setup

Prerequisites

Make sure you have Node.js installed on your machine.

Install dependencies

cd client
npm install

Run the React application

npm start

The React application should open in your browser at http://localhost:3000.

Your PERN application is now configured. Ensure that the backend server is running with the node --watch .\server\index.js command during development.

Adjust paths and commands based on your specific project structure.

API Documentation

Base URL

http://localhost:5000

Create a Conversation

Request:

  • Endpoint: POST /conversations
  • Description: Create a new conversation.
  • Request Body:
    • user_id (integer): User ID.
    • assistant_id (integer): Assistant/Bot ID.
    • title (string): Conversation title.
{
  "user_id": 1,
  "assistant_id": 2,
  "title": "Sample Conversation"
}

Response:

  • Status Code: 200 OK
  • Response Body:
    • Details of the created conversation.
{
  "conversation_id": 1,
  "user_id": 1,
  "assistant_id": 2,
  "title": "Sample Conversation",
  "timestamp": "2023-12-13T12:34:56Z"
}

For more API documentation, refer to @API_DOC.md.

Sources

For detailed setup instructions, refer to @SETUP.md.

tolkai_test's People

Contributors

drackass avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.