Feat: Allow users to delete their profile pictures #3221 (#9826)

### What problem does this PR solve?

Feat: Allow users to delete their profile pictures  #3221

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-08-29 17:12:45 +08:00
committed by GitHub
parent e997bf6507
commit 4fbad2828c
2 changed files with 19 additions and 1 deletions

View File

@ -1,5 +1,5 @@
import { transformFile2Base64 } from '@/utils/file-util';
import { Pencil, Upload } from 'lucide-react';
import { Pencil, Upload, XIcon } from 'lucide-react';
import {
ChangeEventHandler,
forwardRef,
@ -9,6 +9,7 @@ import {
} from 'react';
import { useTranslation } from 'react-i18next';
import { Avatar, AvatarFallback, AvatarImage } from './ui/avatar';
import { Button } from './ui/button';
import { Input } from './ui/input';
type AvatarUploadProps = { value?: string; onChange?: (value: string) => void };
@ -31,6 +32,11 @@ export const AvatarUpload = forwardRef<HTMLInputElement, AvatarUploadProps>(
[onChange],
);
const handleRemove = useCallback(() => {
setAvatarBase64Str('');
onChange?.('');
}, [onChange]);
useEffect(() => {
if (value) {
setAvatarBase64Str(value);
@ -59,6 +65,15 @@ export const AvatarUpload = forwardRef<HTMLInputElement, AvatarUploadProps>(
className="absolute right-2 bottom-0 opacity-50 hidden group-hover:block"
/>
</div>
<Button
onClick={handleRemove}
size="icon"
className="border-background focus-visible:border-background absolute -top-2 -right-2 size-6 rounded-full border-2 shadow-none z-10"
aria-label="Remove image"
type="button"
>
<XIcon className="size-3.5" />
</Button>
</div>
)}
<Input

View File

@ -135,6 +135,8 @@ export default {
vectorSimilarityWeight: '相似度相似度权重',
vectorSimilarityWeightTip:
'我们使用混合相似性评分来评估两行文本之间的距离。它是加权关键字相似性和矢量余弦相似性或rerank得分0〜1。两个权重的总和为1.0。',
keywordSimilarityWeight: '关键词相似度权重',
keywordSimilarityWeightTip: '',
testText: '测试文本',
testTextPlaceholder: '请输入您的问题!',
testingLabel: '测试',
@ -759,6 +761,7 @@ General实体和关系提取提示来自 GitHub - microsoft/graphrag基于
view: '查看',
modelsToBeAddedTooltip:
'如果你的模型供应商在这里没有列出,但是宣称 OpenAI-compatible可以通过选择卡片 OpenAI-API-compatible 设置相关模型。',
mcp: 'MCP',
},
message: {
registered: '注册成功',