Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: agent icon remove generate method #3756

Merged
merged 3 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <opensource@illasoft.com>",
"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
Loading