Skip to content

Commit

Permalink
(FE) Implement CodePair AI Assistant (#123)
Browse files Browse the repository at this point in the history
* Add intelligence button

* Update yorkie

* Add yorkie intelligence footer

* Add intelligence feature calling

* Remove deprecated import

* Add followup request

* Add markdown viewer

* Add soft line break

* Update package-lock.json

* Change image path

* Add scroll to feature

* Add insertion logic

* Add replace / insert below

* Add `isComplete` flag to stream API

* Add clear on submit

* Change prompt

* Fix formatting

* Changed `createPortal` to `Poppoer`

* Change `createPortal` to `Poppoer`

* Add CloseIntelligenceModal

* Add default height to intelligence

* Fix lint
  • Loading branch information
devleejb authored Feb 1, 2024
1 parent ac3917a commit 0c8e1af
Show file tree
Hide file tree
Showing 23 changed files with 827 additions and 538 deletions.
2 changes: 1 addition & 1 deletion backend/src/intelligence/prompt/followup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChatPromptTemplate, MessagesPlaceholder } from "langchain/prompts";
import { ChatPromptTemplate, MessagesPlaceholder } from "@langchain/core/prompts";

export const followUpPromptTemplate = ChatPromptTemplate.fromMessages([
[
Expand Down
9 changes: 5 additions & 4 deletions backend/src/intelligence/prompt/github-issue.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ChatPromptTemplate, FewShotChatMessagePromptTemplate } from "langchain/prompts";
import { ChatPromptTemplate, FewShotChatMessagePromptTemplate } from "@langchain/core/prompts";

const examplePrompt = ChatPromptTemplate.fromTemplate(
"## Title\n{title}\n## Issue Type\n{issueType}\n## Content\n{content}"
"[Example]\n## Title\n{title}\n## Issue Type\n{issueType}\n## Content\n{content}"
);

const examples = [
Expand Down Expand Up @@ -73,8 +73,9 @@ Keep the product simple`,
];

export const githubIssuePromptTemplate = new FewShotChatMessagePromptTemplate({
prefix: `I want you to act as a GitHub Issue writer. I will provide brief information about the GitHub issue I want to create, and you should write the GitHub issue based on the examples I provide.
The types of issues you can write are bug 🐞 or enhancement 🌟. Please ensure that you follow the template used in each type of issue example provided. Please write your responses in English.`,
prefix: `I want you to act as a GitHub Issue writer. I will provide brief information about the GitHub issue I want to create, and you should write the GitHub issue.
The types of issues you can write are bug 🐞 or enhancement 🌟. Please ensure that you follow the template used in each type of issue example provided. Do not provide the example as it is. Please write your responses in English.
If there is insufficient information to create the issue, request additional information.`,
suffix: "Brief information about the GitHub issue: {content}",
examplePrompt,
examples,
Expand Down
13 changes: 7 additions & 6 deletions backend/src/intelligence/prompt/github-pr.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { ChatPromptTemplate, FewShotChatMessagePromptTemplate } from "langchain/prompts";
import { ChatPromptTemplate, FewShotChatMessagePromptTemplate } from "@langchain/core/prompts";

const examplePrompt = ChatPromptTemplate.fromTemplate("## Title\n{title}\n## Content\n{content}");
const examplePrompt = ChatPromptTemplate.fromTemplate(
"[Example]\n## Title\n{title}\n## Content\n{content}"
);

const examples = [
{
Expand Down Expand Up @@ -100,10 +102,9 @@ Fixes #
];

export const githubPrPromptTemplate = new FewShotChatMessagePromptTemplate({
prefix: `I want you to act as a GitHub PR Writer for me. I'll provide you with brief notes about GitHub PR, and you just need to write the PR using the examples I've provided.
Make sure to adhere to the template that we commonly follow in Example.
If the information is not provided by the user, please refrain from attaching document links found elsewhere. Please respond in English.
Please refer to the example for guidance, but generate results based on the information provided in the Brief Information section.`,
prefix: `I want you to act as a GitHub PR Writer for me. I'll provide you with brief notes about GitHub PR, and you just need to write the PR.
Please ensure that you follow the template used in example provided. Do not provide the example as it is. Please write your responses in English.
If there is insufficient information to create the PR, request additional information.`,
suffix: "Brief information about the GitHub PR: {content}",
examplePrompt,
examples,
Expand Down
Loading

0 comments on commit 0c8e1af

Please sign in to comment.