-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
107 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Button } from 'antd'; | ||
import { useRouter } from 'next/navigation'; | ||
import React, { memo } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { useGlobalStore } from '@/store/global'; | ||
import { useSessionStore } from '@/store/session'; | ||
import { Agent } from '@/types/agent'; | ||
|
||
interface ChatButtonProps { | ||
agent: Agent; | ||
} | ||
|
||
const ChatButton = memo<ChatButtonProps>(({ agent }) => { | ||
const router = useRouter(); | ||
const { t } = useTranslation('chat'); | ||
const createSession = useSessionStore((s) => s.createSession); | ||
|
||
const [closePanel] = useGlobalStore((s) => [s.closePanel]); | ||
return ( | ||
<Button | ||
key="chat" | ||
onClick={() => { | ||
createSession(agent); | ||
router.push('/chat'); | ||
closePanel('market'); | ||
}} | ||
type={'primary'} | ||
> | ||
{t('chat')} | ||
</Button> | ||
); | ||
}); | ||
|
||
export default ChatButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Button, Popconfirm, message } from 'antd'; | ||
import React, { memo, useState } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { useAgentStore } from '@/store/agent'; | ||
import { useSessionStore } from '@/store/session'; | ||
import { Agent } from '@/types/agent'; | ||
|
||
interface UnSubscribeButtonProps { | ||
agent: Agent; | ||
} | ||
|
||
const UnSubscribe = memo((props: UnSubscribeButtonProps) => { | ||
const { agent } = props; | ||
const removeLocalAgent = useAgentStore((s) => s.removeLocalAgent); | ||
const removeSessionByAgentId = useSessionStore((s) => s.removeSessionByAgentId); | ||
const [loading, setLoading] = useState(false); | ||
|
||
const { t } = useTranslation(['common', 'role']); | ||
|
||
return ( | ||
<Popconfirm | ||
cancelText={t('cancel')} | ||
description={t('delRoleDesc', { name: agent?.meta.name, ns: 'role' })} | ||
key="delete" | ||
okText={t('confirm')} | ||
okButtonProps={{ loading: loading }} | ||
onConfirm={async () => { | ||
if (!agent) return; | ||
setLoading(true); | ||
await removeLocalAgent(agent.agentId); | ||
removeSessionByAgentId(agent.agentId); | ||
setLoading(false); | ||
message.success(t('actions.unsubscribeSuccess')); | ||
}} | ||
title={t('actions.unsubscribe') + '?'} | ||
> | ||
<Button>{t('actions.unsubscribe')}</Button> | ||
</Popconfirm> | ||
); | ||
}); | ||
|
||
export default UnSubscribe; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters