feat: add appicon

This commit is contained in:
dolphin
2025-01-06 21:32:20 +08:00
parent 0ae59259b2
commit 7073fdfc0d
12 changed files with 95 additions and 14 deletions
+7 -2
View File
@@ -234,7 +234,10 @@
"selected": "Selected",
"pleaseSelectAnApp": "Please select an app",
"allLabels": "All labels",
"searchLabels": "Search labels"
"searchLabels": "Search labels",
"confirmed": "Confirmed",
"confirm": "Confirm",
"runNewWorkflow": "Run New Workflow"
},
"model": {
"modelManagement": "Model Management",
@@ -329,7 +332,9 @@
"libraryCollection": "Knowledge Base Collection",
"createUser": "Create User",
"details": "Details",
"confirmDeleteLibrary": "Confirm deletion of this Knowledge Base?"
"confirmDeleteLibrary": "Confirm deletion of this Knowledge Base?",
"copy": "Copy",
"copying": "Copying"
},
"evaluation": {
"id": "Task ID",
+7 -2
View File
@@ -230,7 +230,10 @@
"selected": "已选",
"pleaseSelectAnApp": "请选择一个应用",
"allLabels": "全部标签",
"searchLabels": "搜索标签"
"searchLabels": "搜索标签",
"confirmed": "已确认",
"confirm": "确认",
"runNewWorkflow": "运行新工作流"
},
"model": {
"modelManagement": "模型管理",
@@ -326,7 +329,9 @@
"libraryCollection": "知识库集合",
"createUser": "创建用户",
"details": "详情",
"confirmDeleteLibrary": "确认删除该知识库?"
"confirmDeleteLibrary": "确认删除该知识库?",
"copy": "复制",
"copying": "复制中"
},
"evaluation": {
"id": "任务ID",
@@ -1,6 +1,6 @@
import { AbilitiesIcon, FlowIcon, HelperIcon } from "@/components/bs-icons/app";
import { readTempsDatabase } from "@/controllers/API";
import { AppType } from "@/types/app";
import { Bot } from "lucide-react";
import { useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { SearchInput } from "../../bs-ui/input";
@@ -64,21 +64,21 @@ export default function AppTempSheet({ children, onCustomCreate, onSelect }) {
className={`flex items-center gap-2 px-4 py-2 rounded-md cursor-pointer hover:bg-muted-foreground/10 transition-all duration-200 mb-2 ${type === AppType.FLOW && 'bg-muted-foreground/10'}`}
onClick={() => setType(AppType.FLOW)}
>
{/* <Bot /> */}
<FlowIcon />
<span>{t('workflow')}</span>
</div>
<div
className={`flex items-center gap-2 px-4 py-2 rounded-md cursor-pointer hover:bg-muted-foreground/10 transition-all duration-200 mb-2 ${type === AppType.ASSISTANT && 'bg-muted-foreground/10'}`}
onClick={() => setType(AppType.ASSISTANT)}
>
{/* <Bot /> */}
<HelperIcon />
<span>{t('assistant')}</span>
</div>
<div
className={`flex items-center gap-2 px-4 py-2 rounded-md cursor-pointer hover:bg-muted-foreground/10 transition-all duration-200 mb-2 ${type === AppType.SKILL && 'bg-muted-foreground/10'}`}
onClick={() => setType(AppType.SKILL)}
>
{/* <Bot /> */}
<AbilitiesIcon />
<span>{t('skill')}</span>
</div>
</div>
@@ -0,0 +1,13 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_584_1576)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 7.5C5 6.11929 6.11929 5 7.5 5H16.5C17.8807 5 19 6.11929 19 7.5V16.5C19 17.8807 17.8807 19 16.5 19H7.5C6.11929 19 5 17.8807 5 16.5V7.5Z" fill="black"/>
<rect x="17" y="13" width="2" height="6" rx="1" transform="rotate(180 17 13)" fill="white"/>
<rect x="17" y="9" width="6" height="2" rx="1" transform="rotate(180 17 9)" fill="white"/>
<path d="M10.0094 11.5002C10.115 10.9619 10.885 10.9619 10.9906 11.5002L11.1735 12.4321C11.2126 12.6315 11.3685 12.7874 11.5679 12.8265L12.4998 13.0094C13.0381 13.115 13.0381 13.885 12.4998 13.9906L11.5679 14.1735C11.3685 14.2126 11.2126 14.3685 11.1735 14.5679L10.9906 15.4998C10.885 16.0381 10.115 16.0381 10.0094 15.4998L9.82647 14.5679C9.78735 14.3685 9.63148 14.2126 9.43212 14.1735L8.50019 13.9906C7.9619 13.885 7.9619 13.115 8.50019 13.0094L9.43212 12.8265C9.63148 12.7874 9.78735 12.6315 9.82647 12.4321L10.0094 11.5002Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_584_1576">
<rect width="14" height="14" fill="white" transform="translate(5 5)"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1,9 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="5" y="10" width="14" height="3" rx="1" fill="black"/>
<rect x="5" y="5" width="14" height="3" rx="1" fill="black"/>
<rect x="13" y="7" width="4" height="2" rx="1" transform="rotate(90 13 7)" fill="black"/>
<rect x="9" y="12" width="4" height="2" rx="1" transform="rotate(90 9 12)" fill="black"/>
<rect x="17" y="12" width="4" height="2" rx="1" transform="rotate(90 17 12)" fill="black"/>
<rect x="5" y="15" width="6" height="3" rx="1" fill="black"/>
<rect x="13" y="15" width="6" height="3" rx="1" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 625 B

@@ -0,0 +1,17 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M5 11C5 8.79086 6.79086 7 9 7H15C17.2091 7 19 8.79086 19 11V16.5C19 17.8807 17.8807 19 16.5 19H7.5C6.11929 19 5 17.8807 5 16.5V11Z"
fill="black" />
<path
d="M14.4135 14.0926C14.6917 14.3586 14.7046 14.8028 14.4422 15.0849C13.8306 15.7426 12.8565 16 12 16C11.1435 16 10.1694 15.7426 9.55775 15.0849C9.29544 14.8028 9.30832 14.3586 9.58653 14.0926C9.86474 13.8267 10.3029 13.8397 10.5652 14.1217C10.815 14.3904 11.3487 14.5961 12 14.5961C12.6513 14.5961 13.185 14.3904 13.4348 14.1217C13.6971 13.8397 14.1353 13.8267 14.4135 14.0926Z"
fill="white" />
<path
d="M10.6616 11.8423C10.6616 12.3075 10.2896 12.6846 9.83079 12.6846C9.37195 12.6846 9 12.3075 9 11.8423C9 11.3771 9.37195 11 9.83079 11C10.2896 11 10.6616 11.3771 10.6616 11.8423Z"
fill="white" />
<path
d="M14.1692 12.6846C14.628 12.6846 15 12.3075 15 11.8423C15 11.3771 14.628 11 14.1692 11C13.7104 11 13.3384 11.3771 13.3384 11.8423C13.3384 12.3075 13.7104 12.6846 14.1692 12.6846Z"
fill="white" />
<circle cx="12" cy="4.5" r="1.5" fill="black" />
<rect x="4" y="12" width="2" height="2" fill="black" />
<rect x="18" y="12" width="2" height="2" fill="black" />
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@@ -0,0 +1,25 @@
import React, { forwardRef } from "react";
import Helper from "./helper.svg?react";
import Flow from "./flow.svg?react";
import Abilities from "./Abilities.svg?react";
export const HelperIcon = forwardRef<
SVGSVGElement & { className: any },
React.PropsWithChildren<{ className?: string }>
>((props, ref) => {
return <Helper ref={ref} {...props} />;
});
export const FlowIcon = forwardRef<
SVGSVGElement & { className: any },
React.PropsWithChildren<{ className?: string }>
>((props, ref) => {
return <Flow ref={ref} {...props} />;
});
export const AbilitiesIcon = forwardRef<
SVGSVGElement & { className: any },
React.PropsWithChildren<{ className?: string }>
>((props, ref) => {
return <Abilities ref={ref} {...props} />;
});
@@ -433,7 +433,7 @@ export default function ChatInput({ autoRun, clear, form, wsUrl, onBeforSend, on
variant="outline"
onClick={handleRestartClick}>
<RefreshCw className="mr-1" size={16} />
{t('chat.runNewWorkflow')}
</Button>
}
</div>
@@ -159,7 +159,7 @@ export default function MessageBsChoose({ type = 'choose', logo, data }: { type?
className="h-8"
disabled={inputSended}
onClick={handleSend}
>{inputSended ? '已确认' : '确认'}</Button>
>{inputSended ? t('chat.confirmed') : t('chat.confirm')}</Button>
</div>
</div>
: <div>
@@ -196,7 +196,7 @@ function CustomNode({ data: node, selected, isConnectable }: { data: WorkflowNod
</EditText>
</div>
{!['output', 'condition', 'end'].includes(node.type) && <ChevronDown
className={`absolute right-0 bisheng-label cursor-pointer ${!expend && 'rotate-180'}`}
className={`absolute right-0 bisheng-label cursor-pointer ${expend && 'rotate-180'}`}
size={14}
onClick={() => {
setExpend(!expend)
@@ -18,7 +18,7 @@ import { captureAndAlertRequestErrorHoc } from "@/controllers/request";
import { AppType } from "@/types/app";
import { FlowVersionItem } from "@/types/flow";
import { findParallelNodes } from "@/util/flowUtils";
import { isEqual } from "lodash-es";
import { cloneDeep, isEqual } from "lodash-es";
import { ChevronLeft, EllipsisVertical, PencilLineIcon, Play, ShieldCheck } from "lucide-react";
import { useContext, useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
@@ -138,8 +138,15 @@ const Header = ({ flow, onTabChange, preFlow, onChange }) => {
const handleExportClick = () => {
setOpen(false)
const nFlow = cloneDeep(flow)
// 删除report节点文档key
nFlow.nodes.forEach(node => {
if (node.data.type === 'report') {
node.data.group_params[0].params[0].value.version_key = ''
}
})
const jsonString = `data:text/json;chatset=utf-8,${encodeURIComponent(
JSON.stringify({ ...flow })
JSON.stringify(nFlow)
)}`;
const link = document.createElement("a");
link.href = jsonString;
@@ -256,7 +256,7 @@ export default function KnowledgeFile() {
window.libname = [el.name, el.description];
}}>
<Link to={`/filelib/${el.id}`} className="no-underline hover:underline text-primary" onClick={handleCachePage}>{t('lib.details')}</Link>
{(user.role === 'admin' || user.user_id === el.user_id) && (el.state === 1 ? <Button variant="link" onClick={() => handleCopy(el)}></Button> : <Button variant="link" disabled></Button>)}
{(user.role === 'admin' || user.user_id === el.user_id) && (el.state === 1 ? <Button variant="link" onClick={() => handleCopy(el)}>{t('copy')}</Button> : <Button variant="link" disabled>{t('copying')}</Button>)}
{user.role === 'admin' || user.user_id === el.user_id ?
<Button variant="link" onClick={() => handleDelete(el.id)} className="text-red-500 px-0">{t('delete')}</Button> :
<Button variant="link" className=" text-gray-400 px-0">{t('delete')}</Button>