Skip to content

Commit

Permalink
add pre-commit and github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
samanyougarg committed Feb 10, 2023
1 parent da93a8f commit 46e4299
Show file tree
Hide file tree
Showing 22 changed files with 723 additions and 7,184 deletions.
103 changes: 103 additions & 0 deletions .github/workflows/quality.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Code Quality

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]

jobs:
prettier:
name: "Prettier"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "16"
# cache: "npm"

- name: Install dependencies
run: npm install

- name: Run Prettier check
run: npm run prettier

eslint:
name: "ESLint"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "16"
# cache: "npm"

- name: Install dependencies
run: npm install

- name: Run ESLint check
run: npm run lint

lint-fix:
name: "Fix Lint"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "16"
# cache: "npm"

- name: Install dependencies
run: npm install

- name: Run TypeScript type check
run: npm run lint:fix

types:
name: "Type Check"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "16"
# cache: "npm"

- name: Install dependencies
run: npm install

- name: Run TypeScript type check
run: npm run type-check

find-unused:
name: "Find Unused"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "16"
# cache: "npm"

- name: Install dependencies
run: npm install

- name: Run TypeScript type check
run: npm run find:unused
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
# GitaGPT - Talk to Krishna with Bhagavad Gita AI

![bhagavad-gita-ai](https://user-images.githubusercontent.com/32533774/218021917-c578b980-4e5e-4f2e-82f1-b048bd7f8bdc.jpeg)

[GitaGPT](https://bhagavadgita.ai) is a state-of-the-art AI-powered chatbot that uses the power of artificial intelligence to bring the teachings of Lord Krishna to your everyday life. With GitaGPT, you can have a conversation with Lord Krishna in a conversational manner, receiving personalised answers to your questions and gaining divine guidance in your life.

## Features

- Conversational interaction with Lord Krishna using ChatGPT
- Personalised content tailored to your specific needs
- Pool of knowledge and wisdom from the Bhagavad Gita
- Easy-to-understand answers to your questions about faith, life, and well-being

## How it works

ChatGita uses advanced AI technology to provide you with answers to your questions based on the teachings of the Bhagavad Gita. Simply ask a question related to your faith or life and receive a response in a conversational format. The conversations are recorded in a fixed context to provide you with a better understanding of the teachings of Lord Krishna.

## Why GitaGPT?

GitaGPT offers an unparalleled experience for those seeking to connect with the divine and gain a deeper understanding of the teachings of the Bhagavad Gita. With its user-friendly interface, personalised content, and advanced AI technology, GitaGPT provides you with the spiritual guidance and comfort you need in your life.

## Try ChatGita for yourself

ChatGita has already become viral, with thousands of people using it to answer their everyday queries. Test its accuracy for yourself and see if it can help you gain a deeper understanding of the teachings of Lord Krishna.

## Contributing

We welcome contributions to GitaGPT and encourage you to submit pull requests with any improvements you make. Whether you're fixing a bug or adding a new feature, your contributions will help make GitaGPT the best it can be.

**Here are just a few ways you can get involved:**
Expand Down Expand Up @@ -58,4 +64,5 @@ The `pages/api` directory is mapped to `/api/*`. Files in this directory are tre
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## License

GitaGPT is open source and licensed under the MIT License.
22 changes: 12 additions & 10 deletions apiFunctions/generate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,26 @@ const baseUrl = "/content";

export interface ChatGeneration {
answer: string;
chat_history:any;

chat_history: any;
}

export interface ChatInput{
question: string;
chat_history:any;
export interface ChatInput {
question: string;
chat_history: any;
}

export const GenerateAnswer = ({question,chat_history}:ChatInput): Promise<ChatGeneration> => {
export const GenerateAnswer = ({
question,
chat_history,
}: ChatInput): Promise<ChatGeneration> => {
return new Promise((resolve, reject) => {
Request({
url: `${baseUrl}/bhagavad_gita`,
method: "post",
data: {
question: question,
chat_history:chat_history
},
data: {
question: question,
chat_history: chat_history,
},
})
.then(({ data }) => {
resolve(data);
Expand Down
32 changes: 16 additions & 16 deletions components/ChatBubble/UserDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
import useTimeFormat from '@/utils/useTimeFormat'
import Image from 'next/image'
import useTimeFormat from "@/utils/useTimeFormat";
import Image from "next/image";

interface UserDetailsProps {
sent: boolean
sent: boolean;
// time: string
}

const UserDetails = ({ sent }: UserDetailsProps) => {
return (
<div
className={`flex gap-3 items-center ${sent ? 'flex-row-reverse' : ''}`}>
className={`flex gap-3 items-center ${sent ? "flex-row-reverse" : ""}`}
>
<Image
alt='Krishna'
alt="Krishna"
height={58}
width={58}
className='flex-1 aspect-square h-10 w-10 md:h-14 md:w-14 rounded-full'
src={sent ? '/Avatars/arjuna.png' : '/Avatars/krishna.png'}
className="flex-1 aspect-square h-10 w-10 md:h-14 md:w-14 rounded-full"
src={sent ? "/Avatars/arjuna.png" : "/Avatars/krishna.png"}
/>
<div
className={`flex flex-col gap-2 ${
sent ? 'justify-end items-end' : ''
}`}>
<p className='text-sm font-bold tracking-wider leading-none text-gray-800 uppercase whitespace-nowrap'>
{sent ? 'Arjuna' : 'GitaGPT'}
className={`flex flex-col gap-2 ${sent ? "justify-end items-end" : ""}`}
>
<p className="text-sm font-bold tracking-wider leading-none text-gray-800 uppercase whitespace-nowrap">
{sent ? "Arjuna" : "GitaGPT"}
</p>
<p className='text-xs tracking-wide leading-none text-gray-500'>
<p className="text-xs tracking-wide leading-none text-gray-500">
{/* {useTimeFormat(time)} */}
</p>
</div>
</div>
)
}
);
};

export default UserDetails
export default UserDetails;
33 changes: 18 additions & 15 deletions components/ChatBubble/index.tsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
import UserDetails from './UserDetails'
import UserDetails from "./UserDetails";

interface ChatBubbleProps {
// time: string
message: string
sent: boolean
message: string;
sent: boolean;
}

const ChatBubble = ({ message, sent }: ChatBubbleProps) => {
const ChatBubble = ({ message, sent }: ChatBubbleProps) => {
return (
<>
<div
className={`w-full flex items-start my-6 ${
sent ? 'justify-end' : 'justify-start'
}`}>
sent ? "justify-end" : "justify-start"
}`}
>
<div
className={`flex flex-col space-y-2 ${
sent ? 'justify-end items-end' : 'items-start justify-start'
}`}>
sent ? "justify-end items-end" : "items-start justify-start"
}`}
>
{/* User Details */}
<UserDetails sent={sent} />
{/* Text */}
<div
className={`flex flex-col items-start justify-start p-3 md:p-4 rounded-xl max-w-xl ${
sent
? 'md:mr-6 rounded-tr-none bg-primary-500'
: 'md:ml-6 rounded-tl-none bg-primary-100'
}`}>
<p className='text-sm md:text-base leading-normal text-gray-900'>
? "md:mr-6 rounded-tr-none bg-primary-500"
: "md:ml-6 rounded-tl-none bg-primary-100"
}`}
>
<p className="text-sm md:text-base leading-normal text-gray-900">
{message}
</p>
</div>
</div>
</div>
</>
)
}
);
};

export default ChatBubble
export default ChatBubble;
42 changes: 20 additions & 22 deletions components/ChatSection.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
import ChatBubble from '@/components/ChatBubble'
import Data from '@/constants/sampleData.json'
import { SetStateAction } from 'react'
import ChatBubble from "@/components/ChatBubble";
import Data from "@/constants/sampleData.json";
import { SetStateAction } from "react";

interface ChatSectionProps {
showSuggestions: boolean
showSuggestions: boolean;
setShowSuggestions: React.Dispatch<SetStateAction<boolean>>;
chat?:Array<{sent:boolean,message:string}>;

chat?: Array<{ sent: boolean; message: string }>;
}
const ChatSection = ({showSuggestions,setShowSuggestions,chat}:ChatSectionProps) => {
const ChatSection = ({
showSuggestions,
setShowSuggestions,
chat,
}: ChatSectionProps) => {
return (
<section className='overflow-auto scrollbar-none pr-2'>


<section className="overflow-auto scrollbar-none pr-2">
<ChatBubble
message='Radhey Radhey, I am GitaGPT, a repository of knowledge and wisdom. Allow me to assist you by answering any inquiries you may have. Ask me anything.'
message="Radhey Radhey, I am GitaGPT, a repository of knowledge and wisdom. Allow me to assist you by answering any inquiries you may have. Ask me anything."
sent={false}
/>
{
chat?.map((item:{sent:boolean,message:string},index:number)=>{

return <ChatBubble key={index} message={item.message} sent={item.sent} />
})
}


{chat?.map((item: { sent: boolean; message: string }, index: number) => {
return (
<ChatBubble key={index} message={item.message} sent={item.sent} />
);
})}
</section>
)
}
);
};

export default ChatSection
export default ChatSection;
27 changes: 18 additions & 9 deletions components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
import React from 'react'
import React from "react";

const Header = () => {
return (
<header>
<h1 className='text-4xl md:text-3xl flex items-center justify-center text-center bg-clip-text h-10 md:h-16 text-transparent bg-gradient-to-r from-yellow-500 to-orange-500 font-extrabold mb-1'>
<h1 className="text-4xl md:text-3xl flex items-center justify-center text-center bg-clip-text h-10 md:h-16 text-transparent bg-gradient-to-r from-yellow-500 to-orange-500 font-extrabold mb-1">
BhagavadGita.ai
</h1>
<p className='text-md leading-normal text-center text-gray-500'>
<p className="text-md leading-normal text-center text-gray-500">
Unlock Your Potential with GitaGPT - The AI-Powered Spiritual Companion
</p>
<p className='text-sm leading-normal text-center'><a className="text-transparent bg-clip-text bg-gradient-to-r from-yellow-400 to-amber-600" target="_blank" rel="noreferrer" href="https://writesonic.com/chat?utm_source=bhagavadgita.ai&utm_medium=banner&utm_campaign=bhagavadgita.ai">(Powered by ChatSonic)</a></p>
<div className='flex items-start justify-start px-4 py-2 bg-gray-200 rounded-full mx-auto w-fit mt-3'>
<p className='text-xs font-medium tracking-wide leading-none text-center text-black'>
<p className="text-sm leading-normal text-center">
<a
className="text-transparent bg-clip-text bg-gradient-to-r from-yellow-400 to-amber-600"
target="_blank"
rel="noreferrer"
href="https://writesonic.com/chat?utm_source=bhagavadgita.ai&utm_medium=banner&utm_campaign=bhagavadgita.ai"
>
(Powered by ChatSonic)
</a>
</p>
<div className="flex items-start justify-start px-4 py-2 bg-gray-200 rounded-full mx-auto w-fit mt-3">
<p className="text-xs font-medium tracking-wide leading-none text-center text-black">
250,000+ devotees guided so far
</p>
</div>
</header>
)
}
);
};

export default Header
export default Header;
Loading

0 comments on commit 46e4299

Please sign in to comment.