Skip to content

Commit

Permalink
Merge pull request #3756 from illacloud/beta
Browse files Browse the repository at this point in the history
feat: agent icon remove generate method
  • Loading branch information
Wangtaofeng authored Mar 6, 2024
2 parents 771f8f5 + 26dc42c commit 4fc04f7
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 100 deletions.
2 changes: 1 addition & 1 deletion apps/builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"author": "ILLA Cloud <[email protected]>",
"license": "Apache-2.0",
"version": "4.5.17",
"version": "4.5.18",
"scripts": {
"dev": "vite --strictPort --force",
"build-cloud": "NODE_OPTIONS=--max-old-space-size=12288 vite build --mode cloud",
Expand Down
74 changes: 0 additions & 74 deletions apps/builder/src/page/AI/AIAgent/aiagent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ import { CollaboratorsInfo } from "@/redux/currentApp/collaborators/collaborator
import {
createAgent,
generateDescription,
generateIcon,
putAgentDetail,
uploadAgentIcon,
} from "@/services/agent"
Expand Down Expand Up @@ -177,7 +176,6 @@ export const AIAgent: FC = () => {

// page state
const [generateDescLoading, setGenerateDescLoading] = useState(false)
const [generateIconLoading, setGenerateIconLoading] = useState(false)
const [isRunning, setIsRunning] = useState(false)
const [isConnecting, setIsConnecting] = useState(false)
const [shareDialogVisible, setShareDialogVisible] = useState(false)
Expand Down Expand Up @@ -1054,78 +1052,6 @@ export const AIAgent: FC = () => {
title={t("editor.ai-agent.label.icon")}
required
scrollId={SCROLL_ID.ICON}
subtitle={
<div
css={descContainerStyle}
onClick={async () => {
track(
ILLA_MIXPANEL_EVENT_TYPE.CLICK,
ILLA_MIXPANEL_BUILDER_PAGE_NAME.AI_AGENT_EDIT,
{
element: "icon_generate",
parameter1: getValues("prompt") ? true : false,
parameter5: data.agent.aiAgentID || "-1",
},
)
const currentTime = performance.now()
if (
!getValues("name") ||
!getValues("description")
) {
message.error({
content: t(
"editor.ai-agent.generate-icon.blank",
),
})
return
}
setGenerateIconLoading(true)
try {
const icon = await generateIcon(
getValues("name"),
getValues("description"),
)
track(
ILLA_MIXPANEL_EVENT_TYPE.REQUEST,
ILLA_MIXPANEL_BUILDER_PAGE_NAME.AI_AGENT_EDIT,
{
element: "icon_generate",
consume: performance.now() - currentTime,
parameter2: "suc",
},
)
field.onChange(icon.data.payload)
} catch (e) {
track(
ILLA_MIXPANEL_EVENT_TYPE.REQUEST,
ILLA_MIXPANEL_BUILDER_PAGE_NAME.AI_AGENT_EDIT,
{
element: "icon_generate",
consume: performance.now() - currentTime,
parameter2: "failed",
},
)
message.error({
content: t(
"editor.ai-agent.generate-desc.failed",
),
})
} finally {
setGenerateIconLoading(false)
}
}}
>
{generateIconLoading ? (
<AILoading spin={true} size="12px" />
) : (
<AIIcon />
)}
<div css={descTextStyle}>
{t("editor.ai-agent.generate-desc.button")}
</div>
</div>
}
subtitleTips={t("editor.ai-agent.generate-icon.tooltips")}
>
<MixpanelTrackProvider
basicTrack={track}
Expand Down
25 changes: 0 additions & 25 deletions apps/builder/src/services/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,31 +158,6 @@ export const generateDescription = (prompt: string) => {
)
}

export const generateIcon = (name: string, description: string) => {
return agentRequest<
{
payload: string
},
{
name: string
description: string
}
>(
{
url: `/aiAgent/generateAvatar`,
method: "POST",
data: {
name: encodeURIComponent(name),
description: encodeURIComponent(description),
},
timeout: 600000,
},
{
teamID: getCurrentTeamID(),
},
)
}

export const getAIAgentWsAddress = (
aiAgentID: string,
signal?: AbortSignal,
Expand Down

0 comments on commit 4fc04f7

Please sign in to comment.