/
KDP
/
ADOS
Обзор
Документация
Войти
/
KDP
/
ADOS
Код
Запросы
0
Задачи
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
services/geminiService.ts
35 строк
1 KB
Krylov Dmitry
Рыба
01 янв 2026, 20:44
01 янв 2026, 20:44
f51b546
Код
Авторство
О чём код?
import { GoogleGenAI } from "@google/genai"; import { WorkItem } from "../types"; export const getTaskSummary = async (workItems: WorkItem[]): Promise<string> => { const ai = new GoogleGenAI({ apiKey: process.env.API_KEY }); const taskList = workItems.map(wi => `- [${wi.fields["System.WorkItemType"]}] ${wi.fields["System.Title"]} (State: ${wi.fields["System.State"]}, Priority: ${wi.fields["Microsoft.VSTS.Common.Priority"] || 'N/A'})` ).join('\n'); const prompt = ` Analyze this list of Azure DevOps tasks assigned to an engineer and provide a brief, professional daily briefing. Identify high-priority items and group them logically. Use a friendly tone. Translate the output into Russian as the user is Russian-speaking. Tasks: ${taskList} `; try { const response = await ai.models.generateContent({ model: 'gemini-3-flash-preview', contents: prompt, config: { temperature: 0.7, thinkingConfig: { thinkingBudget: 0 } } }); return response.text || "Не удалось сгенерировать сводку."; } catch (error) { console.error("Gemini Error:", error); return "Ошибка при подключении к AI."; } };