diff --git a/lingtropy-client/src/main/IPCs.ts b/lingtropy-client/src/main/IPCs.ts index d9f5df6..46a78d1 100644 --- a/lingtropy-client/src/main/IPCs.ts +++ b/lingtropy-client/src/main/IPCs.ts @@ -71,11 +71,10 @@ export default class IPCs { ipcMain.handle('call-openai', async (event, baseURL, apiKey, model, count, rawArticle) => { try { const client = new OpenAI({ - apiKey: apiKey, // 从环境变量中获取API密钥 - baseURL: baseURL // 设置代理地址 + apiKey: apiKey, + baseURL: baseURL }) - // 创建 count 个请求 const requests = Array.from({ length: count }, (_, index) => { return client.chat.completions .create({ @@ -84,11 +83,12 @@ export default class IPCs { { role: 'system', content: - '你是一个小红书文案写手,能够熟练地根据用户的输入,改写成内容相近,但表达方式不同的新文案。你的文案中需要具备吸人眼球的钩子,能够牢牢抓住用户的注意力。请直接输出新的文案,不要输出其他任何提示性词语, 以纯文本的形式输出' + '你是一个小红书文案写手,能够熟练地根据用户的输入,改写成内容相近,但表达方式不同的新文案。你的文案中需要具备吸人眼球的钩子,能够牢牢抓住用户的注意力。请直接输出新的文案,不要输出其他任何提示性词语, 以纯文本的形式输出。注意:输出的文案不要超过900字。' }, { role: 'user', content: rawArticle } ], - stream: true // 启用流式输出 + max_tokens: 1800, // 约900字 + stream: true }) .then(async (stream) => { let fullResponse = '' @@ -125,7 +125,6 @@ export default class IPCs { timeout: 30000 }) - // 创建 count 个请求 const requests = Array.from({ length: count }, (_, index) => { return client.chat.completions .create({ @@ -133,11 +132,11 @@ export default class IPCs { messages: [ { role: 'system', - content: '你是一个小红书标题写手,能够熟练地根据用户的输入,改写成内容相近,但表达方式不同的新标题。你的标题中需要具备吸人眼球的钩子,能够牢牢抓住用户的注意力。请直接输出新的标题,不要输出其他任何提示性词语, 以纯文本的形式输出' + content: '你是一个小红书标题写手,能够熟练地根据用户的输入,改写成内容相近,但表达方式不同的新标题。你的标题中需要具备吸人眼球的钩子,能够牢牢抓住用户的注意力。请直接输出新的标题,不要输出其他任何提示性词语, 以纯文本的形式输出。注意:输出的标题不要超过20字。' }, { role: 'user', content: text } ], - max_tokens: 100, + max_tokens: 50, // 约20字 temperature: 0.8, stream: true }) diff --git a/lingtropy-client/src/renderer/components/ResultSection.vue b/lingtropy-client/src/renderer/components/ResultSection.vue index ef06382..d0fe7cf 100644 --- a/lingtropy-client/src/renderer/components/ResultSection.vue +++ b/lingtropy-client/src/renderer/components/ResultSection.vue @@ -66,6 +66,9 @@