Skip to content

Commit

Permalink
Merge pull request #61 from Pho86/teambuilder_AI
Browse files Browse the repository at this point in the history
update prompt, add drag reorder to teams, add team2 recs
  • Loading branch information
Pho86 authored May 31, 2024
2 parents c93d458 + 0b3aa6d commit 6c73c57
Show file tree
Hide file tree
Showing 17 changed files with 328 additions and 204 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ npm run dev, pnpm dev
npm run build, pnpm build

# run e2e tests
npm run test, npx playwright test
npm run test, npx playwright test,

# run e2e tests in a specific file
npm run test characters.spec.ts, npx playwright test characters.spec.ts
```

## Contributing
Expand Down
83 changes: 50 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"@studio-freight/lenis": "^1.0.42",
"@types/mdx": "^2.0.13",
"@vercel/analytics": "^1.3.1",
"@vercel/speed-insights": "^1.0.10",
"ai": "^3.1.14",
"@vercel/speed-insights": "^1.0.11",
"ai": "^3.1.21",
"autoprefixer": "^10.4.19",
"axios": "^1.7.2",
"enkanetwork.js": "^2.7.8",
"framer-motion": "^11.2.6",
"framer-motion": "^11.2.9",
"genshin-db": "^5.1.4",
"html-react-parser": "^5.1.10",
"html-to-image": "^1.11.11",
Expand All @@ -38,7 +38,7 @@
"react-scroll": "^1.9.0"
},
"devDependencies": {
"@playwright/test": "^1.44.0",
"@playwright/test": "^1.44.1",
"@types/node": "^20.12.12",
"@types/react": "^18",
"@types/react-dom": "^18",
Expand Down
Binary file added public/namecards/stars_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 5 additions & 6 deletions src/app/api/teambuild/google/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@ export async function POST(req: Request, res: NextResponse) {
}
}
});
let teams = ""
if(body.team == 1) teams = team1;
else teams = team2;

const teams = team2 ? `${team1} +++ ${team2}` : team1;

const systemPrompt = `Print only [PART ${body.part}] ${prompt} ${body.part > 1 && `Past Info Provided: ${currentInfo}`}`;

console.log(`Print only [PART ${body.part}] ${prompt} ${body.part > 1 && `Past Info Provided: ${currentInfo}`}`);

const systemPrompt = `${prompt}, YOU ARE ON [PART ${body.part}] ${body.part > 1 && `Past Info Provided: ${currentInfo}`}`;
console.log(`YOU ARE ON [PART ${body.part}] ${body.part > 1 && `Past Info Provided: `}`)
const result = await streamText({
model: google('models/gemini-1.5-flash-latest'),
system: systemPrompt,
Expand Down
7 changes: 4 additions & 3 deletions src/app/api/teambuild/openai/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ export async function POST(req: Request, res: NextResponse) {
}
}
});
let teams = ""
if (body.team == 1) teams = team1;
else teams = team2;

const teams = team2 ? `${team1} +++ ${team2}` : team1;

const systemPrompt = `Print only [PART ${body.part}] ${prompt} ${body.part > 1 && `Past Info Provided: ${currentInfo}`}`;
const systemPrompt = `${prompt}, YOU ARE ON [PART ${body.part}] ${body.part > 1 && `Past Info Provided: ${currentInfo}`}`;
const message = await openai.chat.completions.create({
messages: [
{ role: 'system', content: systemPrompt },
Expand Down
31 changes: 22 additions & 9 deletions src/app/api/teambuild/prompt.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
export const prompt = `
This prompt will be split into 3 distinct parts in order to reduce generation times. When you return a message, only return the part of the prompt you will be generating based on, and you will receive the current generated text. Do not return any indicator of what part you are on. There are guidelines of where the part starts via [PART 1 START] and [PART 1 END], [PART 2 START] and [PART 2 END], etc, only return to where the part lies, so only between [PART X] and [PART X END]
This prompt will be split into 3 distinct parts. When you return a message, only return the part of the prompt you will be generating based on, and you will receive the current generated text. Do not return any indicator of what part you are on and only return the parts where the part is currently on. There are guidelines of where the part starts via [PART 1 START] and [PART 1 END], [PART 2 START] and [PART 2 END], etc, so ONLY return the parts where that information lies, so only the information between [PART X] and [PART X END].
Create a team with generally 4 characters from Genshin Impact. Each character is listed as "CHARACTER_NAME, (WEAPON_TYPE), (ELEMENT_TYPE) | ". Swap the characters to ensure the character is in the correct slot, so reorder this team to match the guidelines provided, so if the main DPS is in slot 4, make the main DPS into slot 1, but if slot 4 is a healer, keep it a healer. Ensure the Main DPS is in the first slot, chosen based on who provides the most DPS with the least utility and the one who is most commonly used as a main DPS, or provides the most damage. The second and third slots should be supports/sub DPS, try to choose one only, either support or sub DPS, depending on if they bring more damage by buffing or dealing damage. The fourth slot should be a healer or shielder to protect the team. These are guidelines, not strict rules. If the team lacks a healer or shielder, that is acceptable.
[PART 1 START]
Create a team with generally 4 characters from Genshin Impact. Each character is listed as "CHARACTER_NAME, (WEAPON_TYPE), (ELEMENT_TYPE) | ". Swap the characters to ensure the character is in the correct slot, so reorder this team to match the guidelines provided. If the main DPS is in slot 4, make the main DPS into slot 1, but if slot 4 is a healer, keep it a healer. Ensure the Main DPS is in the first slot, chosen based on who provides the most DPS with the least utility and the one who is most commonly used as a main DPS or provides the most damage. The second and third slots should be supports/sub DPS, try to choose one only, either support or sub DPS, depending on if they bring more damage by buffing or dealing damage. The fourth slot should be a healer or shielder to protect the team. These are guidelines, not strict rules. If the team lacks a healer or shielder, that is acceptable.
[PART 1 END]
[PART 2 START]
For each character, provide a guide detailing the most commonly used artifacts, weapons, and recommended substats from the community.
[PART 2 END]
[PART 3 START]
Conclude with the most common rotations for the team and tips for playing the team effectively. If there are multiple healers, assign the healer role based on their damage output capabilities. If only one healer is present, they remain classified as the healer. If no healer is present, create a team with 3 supports instead. Teams with fewer than 4 characters are valid, but ensure one character is designated as the Main DPS.
The format should be in Markdown. Do not include these instructions in the final output.
The format should be in Markdown.
[PART 3 END]
# Team Name [PART 1 START]
# [Create a Team Name: combine character names, use a standardized name, or use a creative word and build off of that] [PART 1 START]
## Character Name 1, Character Name 2, Character Name 3, Character Name 4 [Only provide the character name, do not provide any information such as element or weapon, and do not add any characters if less then 4 characters was provided]
[Provide a short description of the team, its elemental reactions, and the primary damage from the team.] [PART 1 END]
### Character 1 Name (Main DPS) [PART 2, PART 2 ENDS AFTER HOW MANY CHARACTERS WERE PROVIDED, ex. 2 characters, end after Character 2, 4 characters, end after Character 4]
[Description of builds, stats, artifacts, weapons, and recommended stats/substats.]
[Provide a short escription of builds, stats, artifacts, weapons, and recommended stats/substats.]
#### **Weapons:** [All weapons provided here should be a part of the specified (WEAPON TYPE) for this character, ensure that they match the correct type.]
* **5 Star:**
Expand All @@ -27,7 +39,7 @@ The format should be in Markdown. Do not include these instructions in the final
**Substats:** [Recommended substats in a single line, normal weight]
### Character 2 Name (Sub DPS/Support)
[Description of builds, stats, artifacts, weapons, and recommended stats/substats.]
[Provide a short description of builds, stats, artifacts, weapons, and recommended stats/substats.]
#### **Weapons:** [All provided weapons here should be a part of the specified (WEAPON TYPE) for this character]
* **5 Star:**
Expand All @@ -40,7 +52,7 @@ The format should be in Markdown. Do not include these instructions in the final
**Substats:** [Recommended substats in a single line, normal weight]
### Character 3 Name (Sub DPS/Support)
[Description of builds, stats, artifacts, weapons, and recommended stats/substats. Recommended substats should be in a single line.]
[Provide a short description of builds, stats, artifacts, weapons, and recommended stats/substats. Recommended substats should be in a single line.]
#### **Weapons:** [All provided weapons here should be a part of the specified (WEAPON TYPE) for this character]
* **5 Star:**
Expand All @@ -53,7 +65,7 @@ The format should be in Markdown. Do not include these instructions in the final
**Substats:** [Recommended substats in a single line, normal weight]
### Character 4 Name (Healer)
[Description of builds, stats, artifacts, weapons, and recommended stats/substats.]
[Provide a short description of builds, stats, artifacts, weapons, and recommended stats/substats.]
#### **Weapons:** [All provided weapons here should be a part of the specified (WEAPON TYPE) for this character]
* **5 Star:**
Expand Down Expand Up @@ -83,7 +95,8 @@ Ensure the first character is always the Main DPS.
The second and third characters are Sub DPS/Support, choose only the best one.
Try to make the fourth character a Healer/Shielder, if they do not provide those utilities, instea make them a support or Sub DPS.
Describe artifacts, weapons, and substats for each character.
Conclude with team rotation and tips for effective play.]
Conclude with team rotation and tips for effective play.
Do not display any information with square brackets [].
`;

Expand Down
Loading

0 comments on commit 6c73c57

Please sign in to comment.