diff --git a/README.md b/README.md index 4f1c1af..16bb7df 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # LingTropy +LingTropy 是一个基于 Electron + Vue3 开发的桌面应用,用于文案和标题的智能改写。 + + + 减小包体 yarn global add depcheck depcheck diff --git a/lingtropy-client/src/constants/index.ts b/lingtropy-client/src/constants/index.ts index 4706240..a72b4eb 100644 --- a/lingtropy-client/src/constants/index.ts +++ b/lingtropy-client/src/constants/index.ts @@ -8,7 +8,7 @@ export const API_ENDPOINTS = { export const AI_CONFIG = { DEFAULT_MODEL: 'gpt-4o', CONTENT_MAX_TOKENS: 1800, // 约900字 - TITLE_MAX_TOKENS: 50, // 约20字 + TITLE_MAX_TOKENS: 50, // 约20字 TEMPERATURE: 0.8, MAX_RETRIES: 2, TIMEOUT: 30000 @@ -16,8 +16,10 @@ export const AI_CONFIG = { // 提示词模板 export const PROMPTS = { - CONTENT_REWRITE: '你是一个小红书文案写手,能够熟练地根据用户的输入,改写成内容相近,但表达方式不同的新文案。你的文案中需要具备吸人眼球的钩子,能够牢牢抓住用户的注意力。请直接输出新的文案,不要输出其他任何提示性词语, 以纯文本的形式输出。注意:输出的文案不要超过900字。', - TITLE_REWRITE: '你是一个小红书标题写手,能够熟练地根据用户的输入,改写成内容相近,但表达方式不同的新标题。你的标题中需要具备吸人眼球的钩子,能够牢牢抓住用户的注意力。请直接输出新的标题,不要输出其他任何提示性词语, 以纯文本的形式输出。注意:输出的标题不要超过20字。' + CONTENT_REWRITE: + '你是一个小红书文案写手,能够熟练地根据用户的输入,改写成内容相近,但表达方式不同的新文案。你的文案中需要具备吸人眼球的钩子,能够牢牢抓住用户的注意力。请直接输出新的文案,不要输出其他任何提示性词语, 以纯文本的形式输出。注意:输出的文案不要超过900字。', + TITLE_REWRITE: + '你是一个小红书标题写手,能够熟练地根据用户的输入,改写成内容相近,但表达方式不同的新标题。你的标题中需要具备吸人眼球的钩子,能够牢牢抓住用户的注意力。请直接输出新的标题,不要输出其他任何提示性词语, 以纯文本的形式输出。注意:输出的标题不要超过20字。' } as const // 存储键名 @@ -39,4 +41,4 @@ export const UI_CONFIG = { // export const APP_INFO = { // VERSION: '1.0.0', // NAME: 'LingTropy' -// } as const \ No newline at end of file +// } as const diff --git a/lingtropy-client/src/main/IPCs.ts b/lingtropy-client/src/main/IPCs.ts index 24ae6aa..4e61572 100644 --- a/lingtropy-client/src/main/IPCs.ts +++ b/lingtropy-client/src/main/IPCs.ts @@ -3,13 +3,7 @@ import Constants from './utils/Constants' import Store from 'electron-store' import axios from 'axios' import OpenAI from 'openai' -import { - API_ENDPOINTS, - AI_CONFIG, - PROMPTS, - STORE_KEYS, - APP_INFO -} from '../constants' +import { API_ENDPOINTS, AI_CONFIG, PROMPTS, STORE_KEYS, APP_INFO } from '../constants' const store = new Store() /* @@ -123,7 +117,14 @@ export default class IPCs { ipcMain.handle( 'call-openai-title', - async (event, baseUrl: string, apiKey: string, model: string, count: number, text: string) => { + async ( + event, + baseUrl: string, + apiKey: string, + model: string, + count: number, + text: string + ) => { try { const client = new OpenAI({ baseURL: baseUrl, @@ -139,7 +140,8 @@ export default class IPCs { messages: [ { role: 'system', - content: '你是一个小红书标题写手,能够熟练地根据用户的输入,改写成内容相近,但表达方式不同的新标题。你的标题中需要具备吸人眼球的钩子,能够牢牢抓住用户的注意力。请直接输出新的标题,不要输出其他任何提示性词语, 以纯文本的形式输出。注意:输出的标题不要超过20字。' + content: + '你是一个小红书标题写手,能够熟练地根据用户的输入,改写成内容相近,但表达方式不同的新标题。你的标题中需要具备吸人眼球的钩子,能够牢牢抓住用户的注意力。请直接输出新的标题,不要输出其他任何提示性词语, 以纯文本的形式输出。注意:输出的标题不要超过20字。' }, { role: 'user', content: text } ], @@ -203,7 +205,5 @@ export default class IPCs { }) return dialogResult }) - - } } diff --git a/lingtropy-client/src/renderer/components/FooterComponent.vue b/lingtropy-client/src/renderer/components/FooterComponent.vue index 3b9e54c..0c7f739 100644 --- a/lingtropy-client/src/renderer/components/FooterComponent.vue +++ b/lingtropy-client/src/renderer/components/FooterComponent.vue @@ -49,4 +49,4 @@ font-size: 17px; } } - \ No newline at end of file + diff --git a/lingtropy-client/src/renderer/components/InputSection.vue b/lingtropy-client/src/renderer/components/InputSection.vue index 9267b42..8cc2b59 100644 --- a/lingtropy-client/src/renderer/components/InputSection.vue +++ b/lingtropy-client/src/renderer/components/InputSection.vue @@ -17,11 +17,7 @@ 🔄 单次改写 - + 🔀 批量改写 @@ -31,11 +27,9 @@ 生成数量: - - + - + + >+ @@ -67,17 +62,17 @@ - 改写文案 - @@ -358,7 +353,9 @@ const showToast = (message) => { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: break-word; - transition: border-color 0.3s, box-shadow 0.3s; + transition: + border-color 0.3s, + box-shadow 0.3s; background-color: #f9f9f9; } @@ -465,4 +462,4 @@ const showToast = (message) => { padding: 16px; } } - \ No newline at end of file + diff --git a/lingtropy-client/src/renderer/components/ResultSection.vue b/lingtropy-client/src/renderer/components/ResultSection.vue index d0fe7cf..9dee598 100644 --- a/lingtropy-client/src/renderer/components/ResultSection.vue +++ b/lingtropy-client/src/renderer/components/ResultSection.vue @@ -1,6 +1,6 @@ - + ✨ @@ -25,6 +25,13 @@ {{ model }} {{ results?.length || 0 }} 个结果 + + 复制全部 + @@ -66,9 +73,6 @@ {{ text }} - @@ -87,7 +91,12 @@