diff --git a/action/index.ts b/action/index.ts index 8a5efdc..9b807a3 100644 --- a/action/index.ts +++ b/action/index.ts @@ -1,28 +1,50 @@ "use server"; -import { model, systemHistory } from "@/utils"; -import { Content } from "@google/generative-ai"; +import { model } from "@/utils"; -export const commitMessage = async ({ +export const commitChange = async ({ message, - history, }: { - message: string; - history: Content[]; -}) => { - const chat = model.startChat({ - history: [...(await systemHistory()), ...history], - }); + message: string | null; +}): Promise<{ + data: { + text: string; + } | null; + error: string | null; +}> => { + if (!message || message.trim() === "") { + return { data: null, error: "Please enter a message" }; + } try { - const result = await chat.sendMessage(message); - const response = result.response; + const modelResponse = model.generateContent({ + contents: [{ role: "user", parts: [{ text: message }] }], + systemInstruction: `\ + You are an assistant that helps to provide Git commit messages based on https://www.conventionalcommits.org/en/v1.0.0/. + + - Provide a Git commit message in a code block as txt. + - Do not include the full command (e.g., \`git commit -m "here git message"\`). + - Only provide the commit message itself. + - Suggest 3 different commit messages to give the user some options. + - For example, if the user input is "I change lib folder to utils folder", then the output should be: + + \`\`\`txt refactor(lib): change lib folder to utils folder \n\`\`\`\n + \`\`\`txt refactor(deps): rename lib folder to utils \n\`\`\`\n + \`\`\`txt fix(deps): rename lib folder to utils \n\`\`\`\n + + `, + }); - const text = response.text(); - console.log("text", text); + const response = (await modelResponse).response.text(); - return { success: true, text: text }; + return { + data: { + text: response, + }, + error: null, + }; } catch (error) { - return { success: false, error: error as string }; + console.log("error on action", error); + return { data: null, error: "something went wrong!" }; } }; diff --git a/app/api/route.ts b/app/api/route.ts deleted file mode 100644 index 360af42..0000000 --- a/app/api/route.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { type NextRequest } from "next/server"; -import { model, systemHistory } from "@/utils"; - -export async function GET(request: NextRequest) { - const searchParams = request.nextUrl.searchParams; - const message = searchParams.get("message"); - - if (!message) { - return new Response("No message provided", { status: 400 }); - } - - const chat = model.startChat({ - history: [...(await systemHistory())], - }); - - const result = await chat.sendMessageStream(message); - - const response = await result.response; - - const data = response.text(); - - if (!data) { - return new Response("something went wrong!", { status: 500 }); - } - - return new Response(data); -} diff --git a/app/layout.tsx b/app/layout.tsx index 694ee4e..6e2fe22 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -4,6 +4,12 @@ import "./globals.css"; import { ThemeProvider } from "@/components/provider/theme-provider"; import { Toaster } from "@/components/ui/toaster"; import { siteConfig } from "@/config/site"; +import Link from "next/link"; +import { cn } from "@/lib/utils"; +import { buttonVariants } from "@/components/ui/button"; +import { GitHubLogoIcon } from "@radix-ui/react-icons"; +import { ModeToggle } from "@/components/modeToggle"; +import Image from "next/image"; const inter = Inter({ subsets: ["latin"] }); @@ -54,7 +60,38 @@ export default function RootLayout({ enableSystem disableTransitionOnChange > - {children} +
+
+
+
+ logo +
+ + + + +
+ {children} +
+
diff --git a/app/page.tsx b/app/page.tsx index c32b68e..cc18e28 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,118 +1,157 @@ "use client"; -import { commitMessage } from "@/action"; -import AiLoading from "@/components/AiLoading"; -import Navbar from "@/components/Navbar"; -import ListChat from "@/components/listChat"; +import { commitChange } from "@/action"; import { Button } from "@/components/ui/button"; +import { Card } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { ScrollArea } from "@/components/ui/scroll-area"; +import { toastVariants } from "@/components/ui/toast"; import { useToast } from "@/components/ui/use-toast"; -import { Content } from "@google/generative-ai"; +import { cn } from "@/lib/utils"; import { CornerDownLeft } from "lucide-react"; import React from "react"; +import dynamic from "next/dynamic"; +import ListSuggestion from "@/components/listSuggestion"; +import Loader from "@/components/loader"; + +const EmptyScreen = dynamic(() => import("@/components/emptyScreen"), { + ssr: false, + loading: () => , +}); export default function Home() { - const [chatHistory, setChatHistory] = React.useState([]); const [message, setMessage] = React.useState(null); const [isLoading, setIsLoading] = React.useState(false); + const [error, setError] = React.useState(null); + const [commitChanges, setcommitChanges] = React.useState(null); + const [commitMessages, setcommitMessages] = React.useState( + null + ); const { toast } = useToast(); - const handelSubmit = async (e: React.FormEvent) => { - e.preventDefault(); - - if (!message || message.trim() === "") { + const handelSubmit = async ({ suggestion }: { suggestion: string }) => { + if (suggestion === commitChanges) { toast({ - title: "Error", - description: "Please enter a message", + variant: "destructive", + title: "Uh oh! Something went wrong.", + description: "error: Please enter a different message.", }); return; } setIsLoading(true); + setError(null); try { - setChatHistory((prevMsg) => [ - ...prevMsg, - { role: "user", parts: [{ text: message! }] }, - ]); - - const data = await commitMessage({ - message: message!, - history: chatHistory, + const { data, error } = await commitChange({ + message: suggestion, }); - if (data.success && data.text) { - setChatHistory((prevMsg) => [ - ...prevMsg, - { role: "model", parts: [{ text: data.text }] }, - ]); + if (error) { + setError(error); + toast({ + variant: "destructive", + title: "Uh oh! Something went wrong.", + description: error, + action: ( + + ), + }); } else { - console.log(data.error); - if (data.error) { - toast({ - description: data.error, - }); - } else { + if (data) { + setcommitMessages(data.text); + setcommitChanges(suggestion); + setMessage(""); } } } catch (error) { console.log(error); } finally { setIsLoading(false); - setMessage(""); } }; + const submitForm = ( + e: React.FormEvent, + message: string | null + ): void => { + e.preventDefault(); + handelSubmit({ suggestion: message || "" }); + }; + return ( -
-
- -
- -
- - - {isLoading && } - +
+ +
+
+ + {error ? ( +
+

+ Oops! Something Went Wrong!{" "} + : ( +

+

{error}

+
+ ) : isLoading ? ( + + ) : commitMessages ? ( + + ) : ( + + )} +
+
-
-
+ + submitForm(e, message)} + className="relative overflow-hidden rounded-lg border bg-primary-foreground/50 focus-within:ring-1 focus-within:ring-ring" + > + + setMessage(e.target.value)} + value={message || ""} + disabled={isLoading} + autoComplete="off" + autoFocus + required + /> +
+ -
-
+ Send Message + +
- +
-
-
+ + ); } diff --git a/components/AiLoading.tsx b/components/AiLoading.tsx deleted file mode 100644 index 64438c5..0000000 --- a/components/AiLoading.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { Badge } from "./ui/badge"; - -const AiLoading = () => { - return ( -
- - Thinking... - -
- ); -}; - -export default AiLoading; diff --git a/components/Navbar.tsx b/components/Navbar.tsx deleted file mode 100644 index 1804ae3..0000000 --- a/components/Navbar.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import React from "react"; -import Link from "next/link"; -import { cn } from "@/lib/utils"; -import { buttonVariants } from "./ui/button"; -import { GitHubLogoIcon } from "@radix-ui/react-icons"; -import Image from "next/image"; - -const Navbar = () => { - return ( -
-
- {/* github link */} - - - - - logo -
-
- ); -}; - -export default Navbar; diff --git a/components/emptyScreen.tsx b/components/emptyScreen.tsx new file mode 100644 index 0000000..46fbfbe --- /dev/null +++ b/components/emptyScreen.tsx @@ -0,0 +1,61 @@ +"use client"; + +import Image from "next/image"; +import React from "react"; +import suggestionsData from "./suggestions.json"; +import { Card } from "./ui/card"; + +const EmptyScreen = ({ + onSubmit, +}: { + onSubmit: ({ suggestion }: { suggestion: string }) => void; +}) => { + const messages: string[] = [ + "Commit something awesome!", + "Let's craft some clever commits!", + "Your commit history starts here...", + "Type away and witness the magic!", + "Time to make your commits shine!", + ]; + + const randomMessage = messages[Math.floor(Math.random() * messages.length)]; + + const randomSuggestions = suggestionsData.messages + .sort(() => 0.5 - Math.random()) // Shuffle the array + .slice(0, 3); // Get the first 3 elements + + return ( +
+
+ logo + logo +

{randomMessage}

+
+ {randomSuggestions.map((suggestion, index) => ( + onSubmit({ suggestion })} + > +

{suggestion}

+
+ ))} +
+
+
+ ); +}; + +export default EmptyScreen; diff --git a/components/listChat.tsx b/components/listChat.tsx deleted file mode 100644 index a6ad180..0000000 --- a/components/listChat.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { Content } from "@google/generative-ai"; -import MarkdownReader from "./md-components"; -import { Badge } from "./ui/badge"; - -const ListChat = ({ chatHistory }: { chatHistory: Content[] }) => { - return ( -
- {chatHistory.map((chat, index) => ( -
- {chat.role === "user" ? ( -
- {/*

{chat.content}

*/} -
- -
- - You - -
- ) : ( -
-
- -
-
- )} -
- ))} -
- ); -}; - -export default ListChat; diff --git a/components/listSuggestion.tsx b/components/listSuggestion.tsx new file mode 100644 index 0000000..d26a39f --- /dev/null +++ b/components/listSuggestion.tsx @@ -0,0 +1,19 @@ +import React from "react"; +import MarkdownReader from "./md-components"; + +const ListSuggestion = ({ + suggestions, + commitChanges, +}: { + suggestions: string; + commitChanges: string; +}) => { + return ( +
+

{commitChanges}

+ +
+ ); +}; + +export default ListSuggestion; diff --git a/components/loader.tsx b/components/loader.tsx new file mode 100644 index 0000000..e0cf5f7 --- /dev/null +++ b/components/loader.tsx @@ -0,0 +1,7 @@ +import React from "react"; + +const Loader = () => { + return
; +}; + +export default Loader; diff --git a/components/modeToggle.tsx b/components/modeToggle.tsx new file mode 100644 index 0000000..010b087 --- /dev/null +++ b/components/modeToggle.tsx @@ -0,0 +1,40 @@ +"use client"; + +import * as React from "react"; +import { MoonIcon, SunIcon } from "@radix-ui/react-icons"; +import { useTheme } from "next-themes"; + +import { Button } from "@/components/ui/button"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; + +export function ModeToggle() { + const { setTheme } = useTheme(); + + return ( + + + + + + setTheme("light")}> + Light + + setTheme("dark")}> + Dark + + setTheme("system")}> + System + + + + ); +} diff --git a/components/suggestions.json b/components/suggestions.json new file mode 100644 index 0000000..e78d45e --- /dev/null +++ b/components/suggestions.json @@ -0,0 +1,33 @@ +{ + "messages": [ + "💰 Refactored income tracking to improve accuracy and efficiency.", + "💸 Added new features to optimize income generation.", + "🤑 Implemented a robust system for managing income streams.", + "📈 Increased income by [percentage]% through strategic planning.", + "🚀 Boosted income by optimizing revenue channels.", + "📊 Improved income forecasting and analysis capabilities.", + "💸 Automated income processing to save time and reduce errors.", + "💰 Integrated new income sources to diversify revenue streams.", + "🤑 Streamlined income management processes for greater efficiency.", + "📈 Enhanced income reporting with interactive dashboards.", + "💸 Reduced operating costs to increase net income.", + "💰 Implemented cost-saving measures to maximize income.", + "🤑 Optimized pricing strategies to increase revenue.", + "📈 Grew income by [percentage]% through customer acquisition.", + "🚀 Expanded market reach to generate new income streams.", + "📊 Improved customer segmentation to target high-value customers.", + "💸 Implemented loyalty programs to increase repeat purchases.", + "💰 Enhanced customer service to drive sales and increase income.", + "🤑 Automated marketing campaigns to nurture leads and generate income.", + "📈 Improved website conversion rates to increase online revenue.", + "💸 Integrated social media marketing to reach new customers.", + "💰 Optimized email marketing campaigns for higher ROI.", + "🤑 Implemented cross-selling and upselling strategies to boost income.", + "📈 Partnered with other businesses to generate new income streams.", + "💸 Explored new revenue models to diversify income sources.", + "💰 Improved financial planning to maximize income potential.", + "🤑 Implemented risk management strategies to protect income streams.", + "📈 Conducted market research to identify growth opportunities for income.", + "🚀 Set ambitious income goals and developed strategies to achieve them." + ] +} diff --git a/components/ui/toast.tsx b/components/ui/toast.tsx index 344b143..1cf0648 100644 --- a/components/ui/toast.tsx +++ b/components/ui/toast.tsx @@ -24,14 +24,14 @@ const ToastViewport = React.forwardRef< )); ToastViewport.displayName = ToastPrimitives.Viewport.displayName; -const toastVariants = cva( +export const toastVariants = cva( "group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full", { variants: { variant: { default: "border bg-background text-foreground", destructive: - "destructive group border-destructive bg-destructive text-destructive-foreground", + "border-[#5b3b04] bg-[#191001] text-[#e5d07b]", }, }, defaultVariants: { diff --git a/package.json b/package.json index 5cdfd94..e2e20ba 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,16 @@ { "name": "commitly", - "version": "0.1.0", + "description": "Tired of boring and repetitive git commit messages? Our AI bot has got you covered! Simply input your changes, and our bot will generate creative and informative commit messages for you. Say goodbye to dull commit logs and hello to engaging and descriptive messages that make your code shine.", + "version": "1.0.0", "private": true, + "author": { + "name": "ruru.dev07", + "email": "ruru.dev07@gmail.com", + "url": "https://ruru-dev07.vercel.app" + }, + "repository": { + "url": "https://github.com/ruru-m07/commitly" + }, "scripts": { "dev": "next dev", "build": "next build", diff --git a/public/logo-dark.png b/public/logo-dark.png new file mode 100644 index 0000000..4d64188 Binary files /dev/null and b/public/logo-dark.png differ diff --git a/public/logo-light.png b/public/logo-light.png new file mode 100644 index 0000000..1523ecd Binary files /dev/null and b/public/logo-light.png differ diff --git a/public/system.txt b/public/system.txt deleted file mode 100644 index 4724f80..0000000 --- a/public/system.txt +++ /dev/null @@ -1,203 +0,0 @@ -you are an assistant that helps to give git messages based on https://www.conventionalcommits.org/en/v1.0.0/. - -# Conventional Commits 1.0.0 - -## Summary - -The Conventional Commits specification is a lightweight convention on top of commit messages. -It provides an easy set of rules for creating an explicit commit history; -which makes it easier to write automated tools on top of. -This convention dovetails with [SemVer](http://semver.org), -by describing the features, fixes, and breaking changes made in commit messages. - -The commit message should be structured as follows: - ---- - -``` -[optional scope]: - -[optional body] - -[optional footer(s)] -``` ---- - -
-The commit contains the following structural elements, to communicate intent to the -consumers of your library: - -1. **fix:** a commit of the _type_ `fix` patches a bug in your codebase (this correlates with [`PATCH`](http://semver.org/#summary) in Semantic Versioning). -1. **feat:** a commit of the _type_ `feat` introduces a new feature to the codebase (this correlates with [`MINOR`](http://semver.org/#summary) in Semantic Versioning). -1. **BREAKING CHANGE:** a commit that has a footer `BREAKING CHANGE:`, or appends a `!` after the type/scope, introduces a breaking API change (correlating with [`MAJOR`](http://semver.org/#summary) in Semantic Versioning). -A BREAKING CHANGE can be part of commits of any _type_. -1. _types_ other than `fix:` and `feat:` are allowed, for example [@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional) (based on the [Angular convention](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines)) recommends `build:`, `chore:`, - `ci:`, `docs:`, `style:`, `refactor:`, `perf:`, `test:`, and others. -1. _footers_ other than `BREAKING CHANGE: ` may be provided and follow a convention similar to - [git trailer format](https://git-scm.com/docs/git-interpret-trailers). - -Additional types are not mandated by the Conventional Commits specification, and have no implicit effect in Semantic Versioning (unless they include a BREAKING CHANGE). -

-A scope may be provided to a commit's type, to provide additional contextual information and is contained within parenthesis, e.g., `feat(parser): add ability to parse arrays`. - -## Examples - -### Commit message with description and breaking change footer -``` -feat: allow provided config object to extend other configs - -BREAKING CHANGE: `extends` key in config file is now used for extending other config files -``` - -### Commit message with `!` to draw attention to breaking change -``` -feat!: send an email to the customer when a product is shipped -``` - -### Commit message with scope and `!` to draw attention to breaking change -``` -feat(api)!: send an email to the customer when a product is shipped -``` - -### Commit message with both `!` and BREAKING CHANGE footer -``` -chore!: drop support for Node 6 - -BREAKING CHANGE: use JavaScript features not available in Node 6. -``` - -### Commit message with no body -``` -docs: correct spelling of CHANGELOG -``` - -### Commit message with scope -``` -feat(lang): add Polish language -``` - -### Commit message with multi-paragraph body and multiple footers -``` -fix: prevent racing of requests - -Introduce a request id and a reference to latest request. Dismiss -incoming responses other than from latest request. - -Remove timeouts which were used to mitigate the racing issue but are -obsolete now. - -Reviewed-by: Z -Refs: #123 -``` - -## Specification - -The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [RFC 2119](https://www.ietf.org/rfc/rfc2119.txt). - -1. Commits MUST be prefixed with a type, which consists of a noun, `feat`, `fix`, etc., followed - by the OPTIONAL scope, OPTIONAL `!`, and REQUIRED terminal colon and space. -1. The type `feat` MUST be used when a commit adds a new feature to your application or library. -1. The type `fix` MUST be used when a commit represents a bug fix for your application. -1. A scope MAY be provided after a type. A scope MUST consist of a noun describing a - section of the codebase surrounded by parenthesis, e.g., `fix(parser):` -1. A description MUST immediately follow the colon and space after the type/scope prefix. -The description is a short summary of the code changes, e.g., _fix: array parsing issue when multiple spaces were contained in string_. -1. A longer commit body MAY be provided after the short description, providing additional contextual information about the code changes. The body MUST begin one blank line after the description. -1. A commit body is free-form and MAY consist of any number of newline separated paragraphs. -1. One or more footers MAY be provided one blank line after the body. Each footer MUST consist of - a word token, followed by either a `:` or `#` separator, followed by a string value (this is inspired by the - [git trailer convention](https://git-scm.com/docs/git-interpret-trailers)). -1. A footer's token MUST use `-` in place of whitespace characters, e.g., `Acked-by` (this helps differentiate - the footer section from a multi-paragraph body). An exception is made for `BREAKING CHANGE`, which MAY also be used as a token. -1. A footer's value MAY contain spaces and newlines, and parsing MUST terminate when the next valid footer - token/separator pair is observed. -1. Breaking changes MUST be indicated in the type/scope prefix of a commit, or as an entry in the - footer. -1. If included as a footer, a breaking change MUST consist of the uppercase text BREAKING CHANGE, followed by a colon, space, and description, e.g., -_BREAKING CHANGE: environment variables now take precedence over config files_. -1. If included in the type/scope prefix, breaking changes MUST be indicated by a - `!` immediately before the `:`. If `!` is used, `BREAKING CHANGE:` MAY be omitted from the footer section, - and the commit description SHALL be used to describe the breaking change. -1. Types other than `feat` and `fix` MAY be used in your commit messages, e.g., _docs: update ref docs._ -1. The units of information that make up Conventional Commits MUST NOT be treated as case sensitive by implementors, with the exception of BREAKING CHANGE which MUST be uppercase. -1. BREAKING-CHANGE MUST be synonymous with BREAKING CHANGE, when used as a token in a footer. - -## Why Use Conventional Commits - -* Automatically generating CHANGELOGs. -* Automatically determining a semantic version bump (based on the types of commits landed). -* Communicating the nature of changes to teammates, the public, and other stakeholders. -* Triggering build and publish processes. -* Making it easier for people to contribute to your projects, by allowing them to explore - a more structured commit history. - -## FAQ - -### How should I deal with commit messages in the initial development phase? - -We recommend that you proceed as if you've already released the product. Typically *somebody*, even if it's your fellow software developers, is using your software. They'll want to know what's fixed, what breaks etc. - -### Are the types in the commit title uppercase or lowercase? - -Any casing may be used, but it's best to be consistent. - -### What do I do if the commit conforms to more than one of the commit types? - -Go back and make multiple commits whenever possible. Part of the benefit of Conventional Commits is its ability to drive us to make more organized commits and PRs. - -### Doesn’t this discourage rapid development and fast iteration? - -It discourages moving fast in a disorganized way. It helps you be able to move fast long term across multiple projects with varied contributors. - -### Might Conventional Commits lead developers to limit the type of commits they make because they'll be thinking in the types provided? - -Conventional Commits encourages us to make more of certain types of commits such as fixes. Other than that, the flexibility of Conventional Commits allows your team to come up with their own types and change those types over time. - -### How does this relate to SemVer? - -`fix` type commits should be translated to `PATCH` releases. `feat` type commits should be translated to `MINOR` releases. Commits with `BREAKING CHANGE` in the commits, regardless of type, should be translated to `MAJOR` releases. - -### How should I version my extensions to the Conventional Commits Specification, e.g. `@jameswomack/conventional-commit-spec`? - -We recommend using SemVer to release your own extensions to this specification (and -encourage you to make these extensions!) - -### What do I do if I accidentally use the wrong commit type? - -#### When you used a type that's of the spec but not the correct type, e.g. `fix` instead of `feat` - -Prior to merging or releasing the mistake, we recommend using `git rebase -i` to edit the commit history. After release, the cleanup will be different according to what tools and processes you use. - -#### When you used a type *not* of the spec, e.g. `feet` instead of `feat` - -In a worst case scenario, it's not the end of the world if a commit lands that does not meet the Conventional Commits specification. It simply means that commit will be missed by tools that are based on the spec. - -### Do all my contributors need to use the Conventional Commits specification? - -No! If you use a squash based workflow on Git lead maintainers can clean up the commit messages as they're merged—adding no workload to casual committers. -A common workflow for this is to have your git system automatically squash commits from a pull request and present a form for the lead maintainer to enter the proper git commit message for the merge. - -### How does Conventional Commits handle revert commits? - -Reverting code can be complicated: are you reverting multiple commits? if you revert a feature, should the next release instead be a patch? - -Conventional Commits does not make an explicit effort to define revert behavior. Instead we leave it to tooling -authors to use the flexibility of _types_ and _footers_ to develop their logic for handling reverts. - -One recommendation is to use the `revert` type, and a footer that references the commit SHAs that are being reverted: - -``` -revert: let us never again speak of the noodle incident - -Refs: 676104e, a215868 -``` - -- make sure you give me an answer in just a single line. -- provide a git commit message in a code block as bash. -- I do not need a full command like => git commit -m "here git message" -- instant I need just massage. -- you can only provide git commits nothing else. -- for example is user input is "i change lib folder to utils folder" then this is output => - -```txt \n refactor(lib): change lib folder to utils folder\n``` - \ No newline at end of file diff --git a/utils/index.ts b/utils/index.ts index f1170d5..34512df 100644 --- a/utils/index.ts +++ b/utils/index.ts @@ -10,39 +10,4 @@ if (!process.env.API_KEY) { const genAI = new GoogleGenerativeAI(process.env.API_KEY!); -export const model = genAI.getGenerativeModel({ model: "gemini-pro" }); - -export const systemHistory = async () => { - const protocol = process.env.NODE_ENV === "production" ? "https" : "http"; - - console.log("protocol", protocol); - console.log("VERCEL_URL", process.env.VERCEL_URL); - - const systemdata = await fetch( - `${protocol}://${process.env.VERCEL_URL}/system.txt`, - ); - const systemText = await systemdata.text(); - - if (systemText) { - console.log("is systemText", true); - } - - return [ - { - role: "user", - parts: [ - { - text: systemText, - }, - ], - }, - { - role: "model", - parts: [ - { - text: "```txt \n feat(api): allow users to reset their password\n```", - }, - ], - }, - ]; -}; +export const model = genAI.getGenerativeModel({ model: "gemini-1.5-pro-latest" });