[공지] 2025 유망 사업 트렌드
본문
2025 유망 사업 트렌드: 기회의 지도를 펼치다
';
showModal();
const apiKey = "";
const apiUrl = `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=${apiKey}`;">https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=${apiKey}`;</a>
const prompt = `2025년 비즈니스 트렌드인 '${trend}'에 대한 다음 설명을 참고하여, 구체적이고 창의적인 사업 아이디어 3가지를 제안해줘. 설명: ${context}.`;
const payload = {
contents: [{
role: "user",
parts: [{ text: prompt }]
}],
generationConfig: {
responseMimeType: "application/json",
responseSchema: {
type: "ARRAY",
items: {
type: "OBJECT",
properties: {
ideaName: { "type": "STRING", "description": "사업 아이디어의 이름" },
concept: { "type": "STRING", "description": "사업 아이디어의 구체적인 컨셉 설명" },
targetCustomer: { "type": "STRING", "description": "주요 타겟 고객층" }
},
required: ["ideaName", "concept", "targetCustomer"]
}
}
}
};
try {
const response = await fetch(apiUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload)
});
if (!response.ok) {
throw new Error(`API 요청 실패: ${response.status}`);
}
const result = await response.json();
if (result.candidates && result.candidates.length > 0) {
const ideasText = result.candidates[0].content.parts[0].text;
const ideas = JSON.parse(ideasText);
modalBody.innerHTML = '';
ideas.forEach(idea => {
const ideaEl = document.createElement('div');
ideaEl.className = 'mb-6 p-4 border-l-4 border-[#0a9396] bg-slate-50 rounded-r-lg';
ideaEl.innerHTML = `
${idea.ideaName}
${idea.concept}
타겟 고객: ${idea.targetCustomer}
`; modalBody.appendChild(ideaEl); }); } else { throw new Error("API로부터 유효한 아이디어를 받지 못했습니다."); } } catch (error) { console.error("Gemini API 호출 오류:", error); modalBody.innerHTML = `아이디어를 생성하는 중 오류가 발생했습니다. 잠시 후 다시 시도해 주세요.
`; } } document.querySelectorAll('.gemini-btn').forEach(button => { button.addEventListener('click', () => { const trend = button.dataset.trend; const context = button.dataset.context; getBusinessIdeas(trend, context); }); }); document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); document.querySelector(this.getAttribute('href')).scrollIntoView({ behavior: 'smooth' }); }); }); });등록된 댓글이 없습니다.







