Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed menu inconsistencies, added some prompts, cleaned up #75

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,32 @@ export enum MenuIds {
export const menuText = {
mainMenu: {
backButton: '⬅️ Back',
menuName: 'Main Menu',
menuName: `
Main Menu

🌟 Welcome to the Harmony One Bot! 🤖

💲 Send money to your /balance to start! 🚀
`,
},
imageMenu: {
menuName: '👨‍🎨 Image Generation',
backButton: '⬅️ Back',
helpText: `👨‍🎨 Image Generation
helpText: `🖼️ *Stable Diffusion Help*

*1. GENERATE A SINGLE IMAGE*
• Use */image <PROMPTS>*

*Example:* \`/image On a sunny day city street, neon signs and streetlights reflect off the wet pavement. Pedestrians hustle with umbrellas, and cars pass with headlights gleaming. Painted with hyperrealistic precision, inspired by artists like Chuck Close, this scene captures every droplet and glint of light, creating an image so lifelike it appears almost like a photograph.
\`

*2. GENERAGE MULTIPLE IMAGES*
• Use */images <PROMPTS>*

Help text for this menu
`,
*Example:* \`/images A futuristic cityscape with towering skyscrapers, flying vehicles, and a diverse population of humans and robots, painted in a concept art style inspired by Syd Mead, with a focus on detail and realism.
\`

`,

}
}
Expand Down
99 changes: 52 additions & 47 deletions src/modules/open-ai/pages/chatPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { BotContext } from "../../types";
import { isAdmin } from "../utils/context";
import { MenuIds } from "../../../constants";
import { ChatGPTModelsEnum } from "../types";
import { menuText } from "../../../constants";

export const chatGptMenuText = {
helpText: `*🖌️ ChatGPT Help*
Expand All @@ -14,53 +15,57 @@ export const chatGptMenuText = {
};

export const chatMainMenu = new Menu<BotContext>(MenuIds.CHAT_GPT_MAIN)
.text(
(ctx) =>
`${
ctx.session.openAi.chatGpt.isEnabled
? "🔴 Disable bot"
: "🟢 Enable bot"
}`,
async (ctx) => {
if (await isAdmin(ctx)) {
ctx.session.openAi.chatGpt.isEnabled =
!ctx.session.openAi.chatGpt.isEnabled;
ctx.menu.update();
} else {
ctx
.editMessageText("Only the group owner can enable/disable this bot", {
parse_mode: "Markdown",
disable_web_page_preview: true,
})
.catch((ex: any) => console.log("### ex", ex));
}
}
)
.row()
.text("Change default model", async (ctx) => {
if (await isAdmin(ctx)) {
ctx
.editMessageText(appText.chatGptChangeModel, {
parse_mode: "HTML",
reply_markup: chatGPTimageDefaultOptions,
})
.catch((ex: any) => {
console.log("### ex", ex);
});
} else {
ctx
.editMessageText(
"Only the group owner can change OpenAI configuration",
{
parse_mode: "Markdown",
disable_web_page_preview: true,
}
)
.catch((ex: any) => console.log("### ex", ex));
}
})
.row()
.back("⬅️ Back");
// .text(
// (ctx) =>
// `${
// ctx.session.openAi.chatGpt.isEnabled
// ? "🔴 Disable bot"
// : "🟢 Enable bot"
// }`,
// async (ctx) => {
// if (await isAdmin(ctx)) {
// ctx.session.openAi.chatGpt.isEnabled =
// !ctx.session.openAi.chatGpt.isEnabled;
// ctx.menu.update();
// } else {
// ctx
// .editMessageText("Only the group owner can enable/disable this bot", {
// parse_mode: "Markdown",
// disable_web_page_preview: true,
// })
// .catch((ex: any) => console.log("### ex", ex));
// }
// }
// )
// .row()
// .text("Change default model", async (ctx) => {
// if (await isAdmin(ctx)) {
// ctx
// .editMessageText(appText.chatGptChangeModel, {
// parse_mode: "HTML",
// reply_markup: chatGPTimageDefaultOptions,
// })
// .catch((ex: any) => {
// console.log("### ex", ex);
// });
// } else {
// ctx
// .editMessageText(
// "Only the group owner can change OpenAI configuration",
// {
// parse_mode: "Markdown",
// disable_web_page_preview: true,
// }
// )
// .catch((ex: any) => console.log("### ex", ex));
// }
// })
// .row()
.back(menuText.mainMenu.backButton, (ctx) => {
ctx.editMessageText(menuText.mainMenu.menuName).catch((ex) => {
console.log("### ex", ex);
});
});

const chatGPTimageDefaultOptions = new Menu<BotContext>(MenuIds.CHAT_GPT_MODEL)
// gpt-4, gpt-4-0613, gpt-4-32k, gpt-4-32k-0613, gpt-3.5-turbo, gpt-3.5-turbo-0613, gpt-3.5-turbo-16k, gpt-3.5-turbo-16k-0613
Expand Down
46 changes: 23 additions & 23 deletions src/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,29 @@ import { MenuIds, menuText } from "./constants";
import { walletMenu, walletMenuText } from "./modules/wallet/menu";

const imageMenu = new Menu<BotContext>(MenuIds.IMAGE_MENU)
.submenu(
"🖼️ Image Generation Stable Diffusion",
MenuIds.SD_IMAGES_MAIN,
(ctx) => {
ctx
.editMessageText(sdImagesMenuText.helpText, {
parse_mode: "Markdown",
})
.catch((ex: any) => {
console.log("### ex", ex);
});
}
)
.row()
.submenu("🎨 Image Generation DALL·E 2", MenuIds.IMAGE_GEN_MAIN, (ctx) => {
ctx
.editMessageText(openAiMenuText.helpText, {
parse_mode: "Markdown",
})
.catch((ex: any) => {
console.log("### ex", ex);
});
})
// .submenu(
// "🖼️ Image Generation Stable Diffusion",
// MenuIds.SD_IMAGES_MAIN,
// (ctx) => {
// ctx
// .editMessageText(sdImagesMenuText.helpText, {
// parse_mode: "Markdown",
// })
// .catch((ex: any) => {
// console.log("### ex", ex);
// });
// }
// )
// .row()
// .submenu("🎨 Image Generation DALL·E 2", MenuIds.IMAGE_GEN_MAIN, (ctx) => {
// ctx
// .editMessageText(openAiMenuText.helpText, {
// parse_mode: "Markdown",
// })
// .catch((ex: any) => {
// console.log("### ex", ex);
// });
// })
.row()
.back(menuText.mainMenu.backButton, (ctx) => {
ctx.editMessageText(menuText.mainMenu.menuName).catch((ex) => {
Expand Down