Created
August 14, 2025 08:12
-
-
Save longdog/a5c237badfe0c1b2e614f22f79edab6e to your computer and use it in GitHub Desktop.
# AI Fashion Stylist An interactive AI fashion consultant powered by GigaChat and Groq LLMs. The application provides fashion recommendations and expert evaluation of the suggestions. ## Features - Interactive fashion consultation using GigaChat
- Professional evaluation of recommendations using Groq
- Real-time feedback and scoring system ## Pr…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { HumanMessage, SystemMessage } from "@langchain/core/messages"; | |
| import { ChatGroq } from "@langchain/groq"; | |
| import { GigaChat } from "langchain-gigachat"; | |
| import { Agent } from "node:https"; | |
| const httpsAgent = new Agent({ | |
| rejectUnauthorized: false, | |
| }); | |
| const { GIGACHAT_API_KEY } = process.env; | |
| // model 1 | |
| const giga = new GigaChat({ | |
| credentials: GIGACHAT_API_KEY, | |
| model: "GigaChat-Max", | |
| httpsAgent, | |
| temperature: 0, | |
| }); | |
| // model 2 | |
| const groq = new ChatGroq({ | |
| model: "meta-llama/llama-4-scout-17b-16e-instruct", | |
| temperature: 0, | |
| }); | |
| const bold = (s: string) => console.log(`[1m${s}[0m`); | |
| const italic = (s: string) => console.log(`[3m${s}[0m`); | |
| const systemPrompt1 = `Ты - модный стилист-консультант, который помогает людям выбирать одежду. | |
| Ты должен давать советы по стилю и маркам одежды. | |
| Предложи комплект одежды изходя из запроса пользователя, перечислив фасоны, цвета и бренды. Обоснуй свой выбор.`; | |
| const systemPrompt2 = `Ты - профессиональный стилист-наставник, который оценивает рекомендации по стилю от молодых стилистов. | |
| Ты должен анализировать рекомендации и давать советы по улучшению. В конце дай вывод о квалификации стилиста и поставь оценку по 10 бальной системе.`; | |
| bold("Привет! Я модный стилист, могу подобрать образы по вашему запросу!"); | |
| process.stdout.write("> "); | |
| for await (const user of console) { | |
| const messages1 = [new SystemMessage(systemPrompt1), new HumanMessage(user)]; | |
| const reqGiga = await giga.invoke(messages1); | |
| bold("Рекомендации от Gigachat"); | |
| console.log(reqGiga.content); | |
| const messages2 = [ | |
| new SystemMessage(systemPrompt2), | |
| new HumanMessage(reqGiga.content.toString()), | |
| ]; | |
| const reqGroq = await groq.invoke(messages2); | |
| bold("Оценка от Groq"); | |
| italic(reqGroq.content.toString()); | |
| process.exit(0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment