Skip to content

Commit caad90c

Browse files
committed
feat: add more tip in ai-assistant plugin
1 parent 86088a3 commit caad90c

File tree

2 files changed

+36
-25
lines changed

2 files changed

+36
-25
lines changed

client/web/plugins/com.msgbyte.ai-assistant/src/popover.tsx

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ const ActionButton = styled.div`
5151
}
5252
`;
5353

54+
const ActionTip = styled.div`
55+
font-size: 12px;
56+
opacity: 0.6;
57+
`;
58+
5459
export const AssistantPopover: React.FC<{
5560
onCompleted: () => void;
5661
}> = React.memo((props) => {
@@ -115,31 +120,6 @@ export const AssistantPopover: React.FC<{
115120

116121
<Tip>{Translate.helpMeTo}</Tip>
117122

118-
{typeof message === 'string' && message.length > 0 && (
119-
<>
120-
<ActionButton
121-
onClick={() => handleCallAI(improveTextPrompt + message)}
122-
>
123-
{Translate.improveText}
124-
</ActionButton>
125-
<ActionButton
126-
onClick={() => handleCallAI(shorterTextPrompt + message)}
127-
>
128-
{Translate.makeShorter}
129-
</ActionButton>
130-
<ActionButton
131-
onClick={() => handleCallAI(longerTextPrompt + message)}
132-
>
133-
{Translate.makeLonger}
134-
</ActionButton>
135-
<ActionButton
136-
onClick={() => handleCallAI(translateTextPrompt + message)}
137-
>
138-
{Translate.translateInputText}
139-
</ActionButton>
140-
</>
141-
)}
142-
143123
<ActionButton
144124
onClick={async () => {
145125
const plainMessages = (
@@ -165,6 +145,33 @@ export const AssistantPopover: React.FC<{
165145
>
166146
{Translate.summaryMessages}
167147
</ActionButton>
148+
149+
{typeof message === 'string' && message.length > 0 ? (
150+
<>
151+
<ActionButton
152+
onClick={() => handleCallAI(improveTextPrompt + message)}
153+
>
154+
{Translate.improveText}
155+
</ActionButton>
156+
<ActionButton
157+
onClick={() => handleCallAI(shorterTextPrompt + message)}
158+
>
159+
{Translate.makeShorter}
160+
</ActionButton>
161+
<ActionButton
162+
onClick={() => handleCallAI(longerTextPrompt + message)}
163+
>
164+
{Translate.makeLonger}
165+
</ActionButton>
166+
<ActionButton
167+
onClick={() => handleCallAI(translateTextPrompt + message)}
168+
>
169+
{Translate.translateInputText}
170+
</ActionButton>
171+
</>
172+
) : (
173+
<ActionTip>{Translate.inputTextShowMoreActionTip}</ActionTip>
174+
)}
168175
</Root>
169176
);
170177
});

client/web/plugins/com.msgbyte.ai-assistant/src/translate.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ export const Translate = {
2929
'zh-CN': '翻译输入内容',
3030
'en-US': 'Translate Input',
3131
}),
32+
inputTextShowMoreActionTip: localTrans({
33+
'zh-CN': '或者输入内容后展示更多操作',
34+
'en-US': 'Or input message then show more actions',
35+
}),
3236
usage: localTrans({
3337
'zh-CN': '用时',
3438
'en-US': 'Usage',

0 commit comments

Comments
 (0)