From 1accefc1daa739ebf4821b7aec8bac2e1b16b86b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=B2=A9=E5=B2=A9?= Date: Fri, 5 Jun 2026 09:48:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=AE=80=E5=8D=95=E5=AF=B9=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index d4463f3..f40fca4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1 +1,19 @@ -console.log("Hello, LLM to Agent!"); \ No newline at end of file +import OpenAI from 'openai'; +import 'dotenv/config'; + +const client = new OpenAI({ + apiKey: process.env.OPENAI_API_KEY, + baseURL: process.env.OPENAI_BASE_URL, +}); + +const response = await client.chat.completions.create({ + model: 'deepseek-v4-pro', + messages: [ + { role: 'system', content: '你是一个直爽的编程助手,回答尽量简洁。' }, + { role: 'user', content: '什么是闭包?用一句话解释。' }, + ], + temperature: 0.7, +}); + +const reply = response.choices[0]?.message?.content; +console.log(reply); \ No newline at end of file