fix: knowledge status fallback and avatar partial update
parent
8d31644f80
commit
0fb6c4d255
|
|
@ -135,6 +135,8 @@ export const AgentAPI = {
|
|||
update: (id: string, payload: Partial<Agent>) => api.put<Agent>(`/agents/${id}`, payload).then((r) => r.data),
|
||||
remove: (id: string) => api.delete(`/agents/${id}`).then((r) => r.data),
|
||||
|
||||
updateAvatar: (id: string, avatar: string) => api.patch<Agent>(`/agents/${id}/avatar`, { avatar }).then((r) => r.data),
|
||||
|
||||
uploadKnowledge: (id: string, files: File[]) => {
|
||||
const fd = new FormData();
|
||||
files.forEach((f) => fd.append('files', f));
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ export default function AvatarSelector({
|
|||
key={url}
|
||||
onClick={async () => {
|
||||
if (!agent?.id) return;
|
||||
await AgentAPI.update(agent.id, { avatar: url });
|
||||
await AgentAPI.updateAvatar(agent.id, url);
|
||||
onCancel();
|
||||
await onAvatarChange();
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -237,9 +237,9 @@ export default function CapabilitySettings({
|
|||
<div className="flex flex-col gap-1 overflow-hidden">
|
||||
<span className="text-sm font-medium truncate">{item.originalName}</span>
|
||||
<span className="text-[10px] text-gray-400">
|
||||
{(item.size / 1024).toFixed(1)} KB ·{' '}
|
||||
<Tag color={STATUS_TAG[item.status].color} className="m-0 text-[10px] px-1">
|
||||
{STATUS_TAG[item.status].text}
|
||||
{item.size ? `${(item.size / 1024).toFixed(1)} KB` : ''} ·{' '}
|
||||
<Tag color={STATUS_TAG[(item.status || 'ready')].color} className="m-0 text-[10px] px-1">
|
||||
{STATUS_TAG[(item.status || 'ready')].text}
|
||||
</Tag>
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ export function useAgentEditor({ id, isNew, form, message, navigate }: UseAgentE
|
|||
if (!id) return false;
|
||||
try {
|
||||
const url = await uploadAvatar(file as File);
|
||||
await AgentAPI.update(id, { avatar: url });
|
||||
await AgentAPI.updateAvatar(id, url);
|
||||
message.success('头像已更新');
|
||||
setAvatarSelectorOpen(false);
|
||||
refresh();
|
||||
|
|
|
|||
Loading…
Reference in New Issue