Skip to content

Commit 37e15af

Browse files
committed
feat: better artist result
1 parent fcee88e commit 37e15af

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/components/DisplayResult.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const DisplayResult = ({ isLoading, playListData, buttonClick, errorMessages })
66
return (
77
<>
88
{!isLoading.state &&
9-
<section className='bg-gray-200 md:min-w-[40vw] md:max-w-[50%] min-w-[300px] p-4 rounded'>
9+
<section className='bg-gray-200 sm:min-w-[40vw] max-w-[500px] min-w-[300px] p-4 rounded'>
1010
{(playListData.link.length !== 0 && playListData.name.length !== 0)
1111
?
1212
<>

src/components/GeneratePlaylist/DiscoverNewSongs.jsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,25 @@ const DiscoverNewSongs = ({ logOut }) => {
4848
setButtonClicked(true)
4949

5050
try {
51-
const type = isDifferentTypesOfArtists ? 'completely different' : 'similar';
51+
const type = isDifferentTypesOfArtists ? 'completely different' : 'the same';
5252
const popularity = isNotPopularArtists ? 'not popular' : 'popular';
5353
const prompt = `Give me 20 musicians who are ${popularity} and ${type} to the following artists provided: ${artists.join(', ')}. Be sure none of the musicians listed overlap with those provided and that the result is not in list form and not more than 20 musicians. The results should also be separated by a comma.`;
5454

55+
56+
const newPrompt = `Please analyze the following list of musicians: '${artists.join(', ')}', and identify the sub-genre that is associated with 70 - 90% of them. Based on this analysis, please provide a list of 20 musicians who are ${popularity} and are ${type} as the sub-genres. Please ensure that the resulting list does not include any of the musicians from the original list provided. To help narrow down the results, please only provide the list of recommended musicians separated by commas.`
57+
5558
setIsLoading((prevState) => ({ ...prevState, message: `Getting the list of new artists` }));
5659
const response = await openai.createCompletion({
5760
model: "text-davinci-003",
58-
prompt: prompt,
61+
prompt: newPrompt,
5962
max_tokens: 1024,
60-
temperature: 1,
63+
temperature: 0.9,
6164
top_p: 1,
6265
frequency_penalty: 0,
6366
presence_penalty: 0,
6467
});
6568

66-
const artistList = response.data.choices[0].text.replace(/:\n/g, "").trimStart().split(", ");
69+
const artistList = response.data.choices[0].text.replace(/:\n/g, "").trimStart().split(':').at(-1).split(', ');
6770
(artistList.length > 20) ? (artistList.length = 20) : null
6871

6972
setIsLoading((prevState) => ({ ...prevState, message: `Getting the albums of each artist` }));

0 commit comments

Comments
 (0)