15 lines
471 B
TypeScript
15 lines
471 B
TypeScript
import { searchSpotifyTracks } from "../spotify-api.ts";
|
|
import { GetNewSuggestInput, GetNewSuggestOutput } from "../types/api.ts";
|
|
import { generateVibes } from "../ai-suggestion.ts";
|
|
|
|
export async function getNewSuggestion(
|
|
params: GetNewSuggestInput,
|
|
): Promise<GetNewSuggestOutput> {
|
|
const ai_suggestion = await generateVibes(params);
|
|
|
|
const suggestionResults = await searchSpotifyTracks(
|
|
ai_suggestion.songs,
|
|
);
|
|
|
|
return { songs: suggestionResults };
|
|
}
|