Skip to content

Commit

Permalink
Added Privacy Policay page and removed unnecessary console logs
Browse files Browse the repository at this point in the history
  • Loading branch information
piercing-wind committed Jul 15, 2024
1 parent d84d9e2 commit 24a733c
Show file tree
Hide file tree
Showing 55 changed files with 167 additions and 142 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Azure CI/CD Pipeline

on:
push:
branches: [ "azureProd" ]
branches: [ "Production" ]

jobs:
build:
Expand Down
4 changes: 0 additions & 4 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ const nextConfig = {
eslint: {
ignoreDuringBuilds: true,
},
server :{
port: 3000,
}

// experimental: {
// serverComponentsExternalPackages: ['sharp', 'onnxruntime-node'],
// },
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
Warnings:
- You are about to drop the column `aiVoices` on the `subscriptionQuota` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "subscriptionQuota" DROP COLUMN "aiVoices",
ALTER COLUMN "aipresentation" SET DEFAULT 0,
ALTER COLUMN "gpt3_5Question" SET DEFAULT 10,
ALTER COLUMN "gpt4oQuestion" SET DEFAULT 2,
ALTER COLUMN "aiImages" SET DEFAULT 2,
ALTER COLUMN "textToSpeech" SET DEFAULT 1;
11 changes: 5 additions & 6 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,12 @@ model subscriptionQuota {
renewal DateTime? @default(now())
subscriptionStatus SubscriptionStatus @default(free)
aiChatWithDoc Int @default(2)
aipresentation Int @default(1)
gpt3_5Question Int @default(1000)
aipresentation Int @default(0)
gpt3_5Question Int @default(10)
gpt4Question Int @default(0)
gpt4oQuestion Int @default(0)
aiImages Int @default(0)
aiVoices Int? @default(0)
textToSpeech Int @default(0)
gpt4oQuestion Int @default(2)
aiImages Int @default(2)
textToSpeech Int @default(1)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}

Expand Down
1 change: 0 additions & 1 deletion src/actions/chat/chatSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export const getAllPreviousSessionsWithOtherData = async (userId : string) => {

//update the chatName
export const updateChatName = async (session : string, newChatName: string) => {
console.log("updating chat name")
const updatedChat = await db.session.update({
where: { session: session },
data: { chatName: newChatName },
Expand Down
3 changes: 0 additions & 3 deletions src/actions/cloudconvert/cloudconvert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ export const pptxToPdf = async (filePath: string, param : string, userId: string
if (!exportTask || !exportTask.result?.files?.length) {
throw new Error('Export task not completed successfully or no files found');
}
console.log('Exported PDF file:', exportTask.result);
console.log('Exported PDF file:', exportTask.result.files[0]);
console.log('Exported PDF file:', exportTask.result.files[0].url);
const file = exportTask.result.files[0];

// Download the converted PDF file
Expand Down
1 change: 0 additions & 1 deletion src/actions/huggingface/huggingFace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Data, uploadImageToS3 } from '../userPromptImage/uploadImageToS3';

export async function imageGenerator(data: { prompt: string, width?: number, height?: number },userId : string) :Promise<Data> {
const { prompt, width = 768, height = 768 } = data;
console.log('Generating image...');
let imageBlob;
const inference = new HfInference(process.env.HUGGINGFACE_API_KEY);
for (let i = 0; i < 5; i++) {
Expand Down
1 change: 0 additions & 1 deletion src/actions/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export const Register = async (values: z.infer<typeof RegisterUserSchema>,callba
callbackUrl,
plan
);
console.log("Confirmation mail sent on your email");
}

return { success: "Account created successfully! Please confirm with mail sent in your email" };
Expand Down
1 change: 0 additions & 1 deletion src/actions/stabilityai/upscaleImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export const upscaleImage = async (fileName : string, url : string,value : numbe
if(height * width < 262144) throw new Error('Image size is invalid. Please provide valid image size.');
const engineId = 'esrgan-v1-x2plus'
const apiHost = process.env.STABILITY_AI_API_HOST ?? 'https://api.stability.ai'
console.log('function invoked')

const res = await fetch(url) ;
const arrayBuffer = await res.arrayBuffer();
Expand Down
1 change: 0 additions & 1 deletion src/actions/userPromptAudio/userPromptAudio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export type AudioData ={
}

export const addAudioDataToDB = async (data : AudioData) => {
console.log(data);
try{const {id,userId, session,prompt ,audioUrl,fileKey,fileName,fileType} = data;
const res = await db.userPromptAudio.create({
data: {
Expand Down
1 change: 0 additions & 1 deletion src/actions/userPromptImage/imageSessionCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { createChatSession } from "@/actions/chat/chatSession";
import { auth } from "@/auth";

export const createSession = async (name: string, sessionType : string) => {
console.log("Creating Image Session");
const userSession = await auth();
if (!userSession) return "/login";
const session = await createChatSession(userSession?.user?.id || "", name, sessionType);
Expand Down
1 change: 0 additions & 1 deletion src/aiflavoured/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ export const chats = async (message : string) => {
const retrieverChain = RunnableSequence.from([
(prevResult) => {
const standaloneQuestion = prevResult.standalone_question;
console.log(standaloneQuestion);
return { standaloneQuestion };
},
async ({ standaloneQuestion }) => {
Expand Down
1 change: 0 additions & 1 deletion src/aiflavoured/presentation/aiSlidesForPresentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { PromptTemplate } from "@langchain/core/prompts";
import { ChatOpenAI } from "@langchain/openai";
import { slidePrompt, refineOutput } from "./promptsForPresentation";
export const aiSlidesForPresentation = async (model : string = 'gpt-4o', numOfSlides : string = '10', docsData : string, audience : string, wording : string) :Promise<string> => {
console.log("working on it...");
let slideData : string = "";
try{

Expand Down
2 changes: 0 additions & 2 deletions src/aiflavoured/presentation/bogus/getSlidesDataFromAi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
import { BaseLanguageModel, BaseLanguageModelCallOptions, BaseLanguageModelInterface } from "@langchain/core/language_models/base";

export const getSlidesDataFromAi = async (docs?: any, aiModel?: string) => {
console.log("received text from docs and generating summary");
const documents = []; //temprary storage for documents


Expand Down Expand Up @@ -52,6 +51,5 @@ export const getSlidesDataFromAi = async (docs?: any, aiModel?: string) => {
});

const summary = await summarizeChain.invoke({ input_documents: docText });
console.log(summary);
return summary.output_text;
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { LLMChain, RefineDocumentsChain, loadSummarizationChain } from "langchai
import { Input } from "@/components/ui/input";

export const getSlidesDataFromAi2 = async (docs?: any, aiModel?: string) => {
console.log("received text from docs and generating summary");
const splitter = new TokenTextSplitter({
chunkSize: 16000,
chunkOverlap: 300,
Expand All @@ -37,7 +36,7 @@ export const getSlidesDataFromAi2 = async (docs?: any, aiModel?: string) => {
// },
// {
// context : ({input}) => input.context,
// numberOfSlides : ({input}) => input.numberOfSlides,
// numberOfSlides : ({input}) => input.numberOfSlidzes,
// userPrompt : ({input}) => input.userPrompt,
// },
// slideChain,
Expand Down
1 change: 0 additions & 1 deletion src/aiflavoured/presentation/bogus/presentation2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ const titleAndContent = async (pptx: pptxgen, image : string, model : string) =>
return pptx;
};
const titleSlide =async (pptx: pptxgen, image : string, model : string) => {
console.log('model', model)
const dominantColors : string = await histogram(image);
console.log("dominantColors", dominantColors);
const colors = await getTheBestColorForTitleAndSubheading(model , dominantColors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export type Localbase64Image = {
mime : string;
};
export const getImagesFromGoogleAsBase64ArrayWithoutHeaders = async ( query : string) =>{
console.log('Converting images to base64 without header')
try {
let filteredImagesDesgins : Base64Image[] = [];
let base64Images: Base64Image[] = [];
Expand All @@ -70,33 +69,28 @@ export const getImagesFromGoogleAsBase64ArrayWithoutHeaders = async ( query : st
const base64Image = await imageToBase64(image);
if(base64Image !== 'fetch failed'){
base64Images.push({link : image, base64 : base64Image, mime : mime});
console.log({link : image, base64 : base64Image.substring(0,100), mime : mime})
}
}
}catch(e){
console.log(e)
}
}
const filterAI = await googleImagesDesignFilterAI('gpt-4o', base64Images) as string[];
console.log(filterAI)
if(filterAI){
for(let i=0; i < filterAI.length; i++){
if(filterAI[i].toLocaleLowerCase() === 'yes' || filterAI[i].toLocaleLowerCase() === 'yes.' || filterAI[i].toLocaleLowerCase().includes('yes')){
console.log("Added")
filteredImagesDesgins.push(base64Images[i]);
}
}}

}
console.log(filteredImagesDesgins)
return filteredImagesDesgins;
} catch (e) {
console.log("Error from here",e);
}

}
export const getImagesFromGoogleAsBase64ArrayWithHeaders =async ( query : string) =>{
console.log('working on images from google as base64 with headers')
try {
let base64Image = ""
let base64Images: Base64Image[] = [];
Expand Down
2 changes: 0 additions & 2 deletions src/aiflavoured/presentation/getTheTopicOfPresentaionAI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { PromptTemplate } from "@langchain/core/prompts";
import { ChatOpenAI } from "@langchain/openai";

export const getTheTopicOfPresentaionAI=async (model: string, data: string)=>{
console.log('model used for getTheTopicOfPresentaionAI', model)
const llm = new ChatOpenAI({
openAIApiKey: process.env.OPENAI_API_KEY,
temperature: 0.2,
Expand Down Expand Up @@ -42,7 +41,6 @@ export const getTheTopicOfPresentaionAI=async (model: string, data: string)=>{
return title;
}
export const getTheTopicOfPresentaionAITweaker=async (model: string, data: string)=>{
console.log('model used for getTheTopicOfPresentaionAI', model)
const llm = new ChatOpenAI({
openAIApiKey: process.env.OPENAI_API_KEY,
temperature: 0.2,
Expand Down
3 changes: 0 additions & 3 deletions src/aiflavoured/presentation/googleImagesDesignFilterAI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ export const googleImagesDesignFilterAI = async (
try {
const base64 = items.base64;
const mime = items.mime;
console.log("base64 from ai", base64.substring(0, 100));
console.log("mime from ai", mime);
const message = new HumanMessage({
content: [
{
Expand All @@ -42,7 +40,6 @@ export const googleImagesDesignFilterAI = async (
],
});
const response = await chat.invoke([message]);
console.log(response.content);
filteredImageUrls.push(response.content.toString());
} catch (e) {
if (e instanceof Error) {
Expand Down
2 changes: 0 additions & 2 deletions src/aiflavoured/presentation/simplePresentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ const titleAndContent = async (pptx: pptxgen, colors : any, model : string) => {
return pptx;
};
export const spresentation = async () => {
console.log("Called")
const colors = {title: "ffb8ea", body: "f2e8ef"};
let pptx = new pptxgen();
pptx = await titleAndContent(pptx, colors, "gpt-4-turbo");
Expand All @@ -178,7 +177,6 @@ export const spresentation = async () => {
const buffer = ArrayBuffer.isView(streamData) ? streamData.buffer : undefined;

if (buffer) {
console.log("exiting")
fs.writeFileSync("output/FPresentation.pptx", new Uint8Array(buffer));
}
};
7 changes: 0 additions & 7 deletions src/aiflavoured/presentation/themes/biomePresentationTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1729,7 +1729,6 @@ const pictureWithCaption = async (pptx: pptxgen , font : Font , waterMark : bool
}

export const biomePresentationTheme = async ({author, title, pptxData, imageSearch, waterMark}: PresentationData , photosWithLink : PresentationImage) => {
console.log("presentaion function call");
try {
let index = 0;
let templatePicker = Math.floor(Math.random() * 4);
Expand Down Expand Up @@ -1914,7 +1913,6 @@ export const biomePresentationTheme = async ({author, title, pptxData, imageSear
});
}
} else {
console.log("bodyTAC is a string")
// bodyTAC is a strin
if(bodyTAC.length < maxCharCountForBody){
let bodyTACString = bodyTAC.replace(/\n/g, '\n\n');
Expand Down Expand Up @@ -1987,7 +1985,6 @@ export const biomePresentationTheme = async ({author, title, pptxData, imageSear
return `${index + 1}. ${item}`
}
}).join('\n');
console.log(lineSpacing)
slideO.addText(contentOString, {
color : colors.body,
placeholder: "body",
Expand Down Expand Up @@ -2526,7 +2523,6 @@ export const biomePresentationTheme = async ({author, title, pptxData, imageSear
} )
break;
default:
console.log(`No slide found for key : ${key}`)
}
slideNumber++;
index++;
Expand All @@ -2536,12 +2532,10 @@ export const biomePresentationTheme = async ({author, title, pptxData, imageSear
}
// Generate a stream
try {
console.log("Generating Stream");
const streamData = await pptx.stream();
const buffer = ArrayBuffer.isView(streamData) ? streamData.buffer : undefined;

if (buffer) {
console.log("exiting")
//temporarily saving the file

fs.writeFileSync(`output/${author}.pptx`, new Uint8Array(buffer));
Expand Down Expand Up @@ -2576,7 +2570,6 @@ export const biomePresentationTheme = async ({author, title, pptxData, imageSear
pptxBufferBase64,
filePath
}
console.log("exitng from presention")
return data;

} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,6 @@ const pictureWithCaption = async (pptx: pptxgen, font: Font, waterMark: boolean)
}

export const darkThemeMoonPresentation = async ({author, title, pptxData, imageSearch, waterMark}: PresentationData, photosWithLink: PresentationImage) => {
console.log("presentaion function call");
try {

let templatePicker = Math.floor(Math.random() * 4);
Expand Down Expand Up @@ -1566,7 +1565,6 @@ export const darkThemeMoonPresentation = async ({author, title, pptxData, imageS
});
}
} else {
console.log("bodyTAC is a string")
// bodyTAC is a strin
if (bodyTAC.length < maxCharCountForBody) {
let bodyTACString = bodyTAC.replace(/\n/g, '\n\n');
Expand Down Expand Up @@ -1639,7 +1637,6 @@ export const darkThemeMoonPresentation = async ({author, title, pptxData, imageS
return `${index + 1}. ${item}`
}
}).join('\n');
console.log(lineSpacing)
slideTC.addText(contentTCString, {
color: colors.body,
placeholder: "leftContent",
Expand Down Expand Up @@ -2133,7 +2130,6 @@ export const darkThemeMoonPresentation = async ({author, title, pptxData, imageS
});
break;
default:
console.log(`No slide found for key : ${key}`)
}
slideNumber++
index++;
Expand All @@ -2143,12 +2139,10 @@ export const darkThemeMoonPresentation = async ({author, title, pptxData, imageS
}
// Generate a stream
try {
console.log("Generating Stream");
const streamData = await pptx.stream();
const buffer = ArrayBuffer.isView(streamData) ? streamData.buffer : undefined;

if (buffer) {
console.log("exiting")
//temporarily saving the file

fs.writeFileSync(`output/${author}.pptx`, new Uint8Array(buffer));
Expand Down Expand Up @@ -2182,7 +2176,6 @@ export const darkThemeMoonPresentation = async ({author, title, pptxData, imageS
pptxBufferBase64,
filePath
}
console.log("exitng from presention")
return data;

} else {
Expand Down
Loading

0 comments on commit 24a733c

Please sign in to comment.