Skip to content

Commit

Permalink
Merge pull request #358 from l3vels/fix/ui-changes
Browse files Browse the repository at this point in the history
Fix/UI changes
  • Loading branch information
Chkhikvadze authored Nov 29, 2023
2 parents f92be7c + 29c00c1 commit b7cbf8b
Show file tree
Hide file tree
Showing 33 changed files with 352 additions and 165 deletions.
1 change: 1 addition & 0 deletions apps/server/models/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ def get_chats(cls, db, account):
.outerjoin(AccountModel, ChatModel.creator_account_id == AccountModel.id)
.outerjoin(TeamModel, ChatModel.team_id == TeamModel.id)
.outerjoin(AgentModel, ChatModel.agent_id == AgentModel.id)
.order_by(ChatModel.created_on.desc())
.filter(
ChatModel.creator_account_id == account.id,
or_(
Expand Down
2 changes: 1 addition & 1 deletion apps/server/utils/configs/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"naming": {
"home": "Home",
"agent": "Agent",
"team": "Team",
"team": "Multi-Agent",
"datasource": "Knowledge",
"model": "Model",
"discovery": "Discovery",
Expand Down
1 change: 1 addition & 0 deletions apps/ui/.env.develop
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ REACT_APP_TWITTER_LINK=https://twitter.com/l3velshq
REACT_APP_YOUTUBE_LINK=https://www.youtube.com/@L3AGI

REACT_APP_YOUTUBE_VIDEO_ID=i84RodECglM
REACT_APP_YOUTUBE_VIDEO_DATA_SOURCE_ID=Fza4gHP_M3o

REACT_APP_TERMS_LINK=https://github.com/l3vels/L3AGI/blob/main/docs/terms.md
REACT_APP_PRIVACY=https://github.com/l3vels/L3AGI/blob/main/docs/privacy.md
Expand Down
2 changes: 2 additions & 0 deletions apps/ui/.env.local
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ REACT_APP_TWITTER_LINK=https://twitter.com/l3velshq
REACT_APP_YOUTUBE_LINK=https://www.youtube.com/@L3AGI

REACT_APP_YOUTUBE_VIDEO_ID=i84RodECglM
REACT_APP_YOUTUBE_VIDEO_DATA_SOURCE_ID=Fza4gHP_M3o


REACT_APP_TERMS_LINK=https://github.com/l3vels/L3AGI/blob/main/docs/terms.md
REACT_APP_PRIVACY=https://github.com/l3vels/L3AGI/blob/main/docs/privacy.md
Expand Down
2 changes: 2 additions & 0 deletions apps/ui/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ REACT_APP_TWITTER_LINK=https://twitter.com/l3velshq
REACT_APP_YOUTUBE_LINK=https://www.youtube.com/@L3AGI

REACT_APP_YOUTUBE_VIDEO_ID=i84RodECglM
REACT_APP_YOUTUBE_VIDEO_DATA_SOURCE_ID=Fza4gHP_M3o


REACT_APP_TERMS_LINK=https://github.com/l3vels/L3AGI/blob/main/docs/terms.md
REACT_APP_PRIVACY=https://github.com/l3vels/L3AGI/blob/main/docs/privacy.md
Expand Down
1 change: 1 addition & 0 deletions apps/ui/src/@types/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface ImportMetaEnv {
readonly REACT_APP_TWITTER_LINK: string
readonly REACT_APP_YOUTUBE_LINK: string
readonly REACT_APP_YOUTUBE_VIDEO_ID: string
readonly REACT_APP_YOUTUBE_VIDEO_DATA_SOURCE_ID: string
readonly REACT_APP_TERMS_LINK: string
readonly REACT_APP_PRIVACY: string
readonly REACT_APP_BASICS_LINK: string
Expand Down
2 changes: 2 additions & 0 deletions apps/ui/src/Route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ import VoiceView from 'plugins/contact/pages/Voice/VoiceView'
import VoiceModal from 'modals/VoiceModal'
import ImportContacts from 'plugins/contact/pages/Contact/ImportContacts'
import CallLogsModal from 'modals/CallLogsModal'
import VideoModal from 'modals/VideoModal'

const Route = () => {
const { loading } = useContext(AuthContext)
Expand Down Expand Up @@ -379,6 +380,7 @@ const Route = () => {
<ScheduleRunModal />
<RunLogsModal />
<CallLogsModal />
<VideoModal />

<CommandMenu
open={cmdkOpen}
Expand Down
Binary file added apps/ui/src/assets/images/fitebase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/ui/src/assets/images/googleAnalytics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions apps/ui/src/components/DemoButton/DemoButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { ButtonTertiary } from 'components/Button/Button'

import Play from '@l3-lib/ui-core/dist/icons/PlayOutline'
import Typography from '@l3-lib/ui-core/dist/Typography'
import Button from '@l3-lib/ui-core/dist/Button'

const DemoButton = ({ onClick }: { onClick: () => void }) => {
return (
<ButtonTertiary onClick={onClick} size={Button.sizes.SMALL}>
<Play size={18} color={'#E332E6'} />
<Typography customColor={'#E332E6'} value={'Demo'} size={Button.sizes.SMALL} />
</ButtonTertiary>
)
}

export default DemoButton
1 change: 1 addition & 0 deletions apps/ui/src/components/DemoButton/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './DemoButton'
Original file line number Diff line number Diff line change
Expand Up @@ -80,29 +80,30 @@ const ChatMembers = ({
<AgentViewDetailBox agentData={agentById} />
<div style={{ height: '200px', width: '100%' }}>
{voiceUrl && (
<StyledAudioPlayerWrapper>
<AudioPlayer audioUrl={voiceUrl} />
</StyledAudioPlayerWrapper>
)}

<StyledLogsButton
onClick={() =>
openModal({
name: CALL_LOGS_MODAL_NAME,
data: {
chatId: call?.chat_id,
},
})
}
>
<StyledLogsIcon size={32} />
<>
<StyledAudioPlayerWrapper>
<AudioPlayer audioUrl={voiceUrl} />
</StyledAudioPlayerWrapper>{' '}
<StyledLogsButton
onClick={() =>
openModal({
name: CALL_LOGS_MODAL_NAME,
data: {
chatId: call?.chat_id,
},
})
}
>
<StyledLogsIcon size={32} />

<TypographyPrimary
value={t('logs')}
type={Typography.types.P}
size={Typography.sizes.sm}
/>
</StyledLogsButton>
<TypographyPrimary
value={t('logs')}
type={Typography.types.P}
size={Typography.sizes.sm}
/>
</StyledLogsButton>
</>
)}
</div>
</TabPanel>

Expand Down
68 changes: 68 additions & 0 deletions apps/ui/src/modals/VideoModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import withRenderModal from 'hocs/withRenderModal'

import Modal from '@l3-lib/ui-core/dist/Modal'

import IconButton from '@l3-lib/ui-core/dist/IconButton'
import Close from '@l3-lib/ui-core/dist/icons/Close'

import { useModal } from 'hooks'
import styled from 'styled-components'
import { StyledButtonWrapper } from './AgentViewModal'

type VideoModalProps = {
data: {
videoSrc: string
}
}

const VideoModal = ({ data }: VideoModalProps) => {
const { closeModal } = useModal()

const { videoSrc } = data

return (
<StyledModal
onClose={() => closeModal('video-modal')}
show
backgroundColor='dark'
hideCloseButton
>
<StyledModalBody>
<StyledIframe
width='900'
height='600'
src={`https://www.youtube.com/embed/${videoSrc}`}
title='YouTube video player'
frameBorder='0'
allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture'
allowFullScreen
></StyledIframe>
</StyledModalBody>

<StyledButtonWrapper>
<IconButton
size={IconButton.sizes.XS}
icon={() => <Close />}
kind={IconButton.kinds.TERTIARY}
onClick={() => closeModal('video-modal')}
/>
</StyledButtonWrapper>
</StyledModal>
)
}

export default withRenderModal('video-modal')(VideoModal)

const StyledModalBody = styled.div`
padding-top: 10px;
`

const StyledModal = styled(Modal)`
.components-Modal-Modal-module__overlay--OO00T {
backdrop-filter: unset;
}
`
const StyledIframe = styled.iframe`
border-radius: 10px;
margin: auto;
`
9 changes: 8 additions & 1 deletion apps/ui/src/pages/Agents/AgentForm/CreateAgentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import { t } from 'i18next'
import { StyledFormWrapper } from 'styles/formStyles.css'
import { useGetAccountModule } from 'utils/useGetAccountModule'

import { StyledCombiner } from 'pages/Datasource/DatasourceForm/CreateDatasourceForm'
import AgentDemoButton from './components/AgentDemoButton'

const CreateAgentForm = () => {
const { formik, isLoading } = useCreateAgent()

Expand All @@ -34,7 +37,11 @@ const CreateAgentForm = () => {
<StyledSectionWrapper>
<StyledHeaderGroup className='header_group'>
<div>
<StyledSectionTitle>{`${t('add-agent')}`}</StyledSectionTitle>
<StyledCombiner>
<StyledSectionTitle>{`${t('add-agent')}`}</StyledSectionTitle>

<AgentDemoButton />
</StyledCombiner>
{/* <StyledSectionDescription>{`${t('agent-description')}`}</StyledSectionDescription> */}
</div>

Expand Down
10 changes: 8 additions & 2 deletions apps/ui/src/pages/Agents/AgentForm/CreateAgentTempate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import { useAgentTemplatesService } from 'services/discover/useAgentTemplatesSer
import TypographyPrimary from 'components/Typography/Primary'
import { useCreateAgent } from '../useCreateAgent'
import { t } from 'i18next'
import { StyledCombiner } from 'pages/Datasource/DatasourceForm/CreateDatasourceForm'
import AgentDemoButton from './components/AgentDemoButton'

const CreateAgentTemplate = () => {
const { refetchAgent } = useCreateAgent()
Expand All @@ -34,7 +36,11 @@ const CreateAgentTemplate = () => {
<StyledSectionWrapper>
<StyledHeaderGroup className='header_group'>
<div>
<StyledSectionTitle>{`${t('add-agent')}`}</StyledSectionTitle>
<StyledCombiner>
<StyledSectionTitle>{`${t('add-agent')}`}</StyledSectionTitle>

<AgentDemoButton />
</StyledCombiner>
{/* <StyledSectionDescription>
Here are all your agents, managing tasks and operations.
</StyledSectionDescription> */}
Expand Down Expand Up @@ -96,7 +102,7 @@ const StyledTemplatesWrapper = styled.div`
height: calc(100vh - 225px);
max-height: 1000px;
max-height: 2500px;
overflow-y: auto;
padding: 0 20px;
width: 100%;
Expand Down
8 changes: 7 additions & 1 deletion apps/ui/src/pages/Agents/AgentForm/EditAgentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import ComponentsWrapper from 'components/ComponentsWrapper/ComponentsWrapper'
import { t } from 'i18next'
import { StyledFormWrapper } from 'styles/formStyles.css'
import { useGetAccountModule } from 'utils/useGetAccountModule'
import { StyledCombiner } from 'pages/Datasource/DatasourceForm/CreateDatasourceForm'
import AgentDemoButton from './components/AgentDemoButton'

const EditAgentForm = () => {
const { t } = useTranslation()
Expand All @@ -32,10 +34,14 @@ const EditAgentForm = () => {
<StyledSectionWrapper>
<StyledHeaderGroup className='header_group'>
<div>
<StyledSectionTitle>{`${t('edit-agent')}`}</StyledSectionTitle>
{/* <StyledSectionDescription>
Here are all your agents, managing tasks and operations.
</StyledSectionDescription> */}
<StyledCombiner>
<StyledSectionTitle>{`${t('edit-agent')}`}</StyledSectionTitle>

<AgentDemoButton />
</StyledCombiner>
</div>

<StyledButtonWrapper>
Expand Down
19 changes: 19 additions & 0 deletions apps/ui/src/pages/Agents/AgentForm/components/AgentDemoButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import DemoButton from 'components/DemoButton'
import { useModal } from 'hooks'

const AgentDemoButton = () => {
const { openModal } = useModal()

return (
<DemoButton
onClick={() =>
openModal({
name: 'video-modal',
data: { videoSrc: import.meta.env.REACT_APP_YOUTUBE_VIDEO_ID },
})
}
/>
)
}

export default AgentDemoButton
42 changes: 9 additions & 33 deletions apps/ui/src/pages/Agents/AgentView/AgentView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,57 +61,33 @@ const AgentView = ({ agentData }: { agentData?: AgentWithConfigs }) => {

<StyledRightColumn>
{system_message?.length ? (
<AdditionalInfoBox items={[system_message]} title={t('system-message')} />
<AdditionalInfoBox items={[system_message]} title={t('system-message')} noCount />
) : null}

{tools?.length > 0 && <AgentToolkits tools={tools} />}

{datasources?.length > 0 && <AgentDatasources datasources={datasources} />}

{goals?.length > 0 && (
<AdditionalInfoBox
items={goals}
title={goals.length === 1 ? `${t('goal')}` : `${goals.length} ${t('goals')}`}
/>
)}
{goals?.length > 0 && <AdditionalInfoBox items={goals} title={'goal'} />}

{constraints?.length > 0 && (
<AdditionalInfoBox
items={constraints}
title={
constraints.length === 1
? `${t('constraint')}`
: `${constraints.length} ${t('constraints')}`
}
/>
<AdditionalInfoBox items={constraints} title={'constraint'} />
)}

{instructions?.length > 0 && (
<AdditionalInfoBox
items={instructions}
title={
instructions.length === 1
? `${t('instruction')}`
: `${instructions.length} ${t('instructions')}`
}
/>
<AdditionalInfoBox items={instructions} title={'instruction'} />
)}

{suggestions?.length > 0 && (
<AdditionalInfoBox
items={suggestions}
title={
suggestions.length === 1
? `${t('suggestion')}`
: `${suggestions.length} ${t('suggestions')}`
}
/>
<AdditionalInfoBox items={suggestions} title={'suggestion'} />
)}

{greeting?.length > 0 && <AdditionalInfoBox items={[greeting]} title={t('greeting')} />}
{greeting?.length > 0 && (
<AdditionalInfoBox items={[greeting]} title={t('greeting')} noCount />
)}

{text?.length > 0 && (
<AdditionalInfoBox items={[text]} title={t('base-system-message')} />
<AdditionalInfoBox items={[text]} title={t('base-system-message')} noCount />
)}
</StyledRightColumn>
</StyledInnerWrapper>
Expand Down
Loading

0 comments on commit b7cbf8b

Please sign in to comment.