Skip to content

Commit

Permalink
Merge branch 'main' of github.com:l3vels/L3AGI
Browse files Browse the repository at this point in the history
  • Loading branch information
Chkhikvadze committed Nov 7, 2023
2 parents a2107b6 + fca4eb6 commit 2726802
Show file tree
Hide file tree
Showing 17 changed files with 27 additions and 136 deletions.
2 changes: 0 additions & 2 deletions apps/server/agents/conversational/conversational.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ def run(
prompt: str,
history: PostgresChatMessageHistory,
human_message_id: str,
run_id: UUID,
sender_user_id: str,
run_logs_manager: RunLogsManager,
pre_retrieved_context: str,
):
Expand Down
30 changes: 8 additions & 22 deletions apps/server/services/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ def process_chat_message(
voice_settings=voice_settings,
team_id=team_id,
parent_id=parent_id,
history=history,
run_id=run.id,
run_logs_manager=run_logs_manager,
)
Expand Down Expand Up @@ -556,31 +557,20 @@ def run_conversational_agent(
voice_settings: AccountVoiceSettings,
run_id: UUID,
run_logs_manager: RunLogsManager,
history: PostgresChatMessageHistory,
team_id: Optional[UUID] = None,
parent_id: Optional[UUID] = None,
):
history = PostgresChatMessageHistory(
session_id=session_id,
sender_account_id=sender_account_id,
sender_user_id=sender_user_id,
sender_name=sender_name,
parent_id=parent_id,
team_id=team_id,
agent_id=agent_with_configs.agent.id,
chat_id=None,
run_id=run_id,
)

datasources = (
data_sources = (
db.session.query(DatasourceModel)
.filter(DatasourceModel.id.in_(agent_with_configs.configs.datasources))
.all()
)

tool_callback_handler = run_logs_manager.get_tool_callback_handler()

datasource_tools = get_datasource_tools(
datasources,
data_source_tools = get_datasource_tools(
data_sources,
settings,
provider_account,
agent_with_configs,
Expand All @@ -599,12 +589,12 @@ def run_conversational_agent(
pre_retrieved_context = ""

if agent_with_configs.configs.source_flow == DataSourceFlow.PRE_RETRIEVAL.value:
if len(datasource_tools) != 0:
pre_retrieved_context = datasource_tools[0]._run(prompt)
if len(data_source_tools) != 0:
pre_retrieved_context = data_source_tools[0]._run(prompt)

tools = agent_tools
else:
tools = datasource_tools + agent_tools
tools = data_source_tools + agent_tools

conversational = ConversationalAgent(sender_name, provider_account, session_id)
return conversational.run(
Expand All @@ -616,17 +606,13 @@ def run_conversational_agent(
prompt,
history,
human_message_id,
run_id,
sender_user_id,
run_logs_manager,
pre_retrieved_context,
)


def create_and_send_chat_message(
session_id: str,
# account: AccountModel,
# sender_user: UserModel,
sender_name: str,
sender_user_id: str,
sender_account_id: str,
Expand Down
11 changes: 0 additions & 11 deletions apps/ui/Pipfile

This file was deleted.

1 change: 1 addition & 0 deletions apps/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
},
"devDependencies": {
"@types/react-syntax-highlighter": "^15.5.6",
"@types/react-table": "^7.7.17",
"@types/uuid": "^9.0.0",
"@typescript-eslint/eslint-plugin": "^5.52.0",
"@typescript-eslint/parser": "^5.52.0",
Expand Down
7 changes: 0 additions & 7 deletions apps/ui/src/gql/ai/llm/providers.gql

This file was deleted.

2 changes: 0 additions & 2 deletions apps/ui/src/modals/RunLogsModal/RunLogs/RunLogs.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import styled from 'styled-components'
import Typography from '@l3-lib/ui-core/dist/Typography'
import TypographyPrimary from 'components/Typography/Primary'
import { useTranslation } from 'react-i18next'
import { useRunLogsService } from 'services/run'
import Loader from '@l3-lib/ui-core/dist/Loader'
Expand Down
37 changes: 0 additions & 37 deletions apps/ui/src/modals/SpotlightModal/SpotlightModal.tsx

This file was deleted.

1 change: 0 additions & 1 deletion apps/ui/src/modals/SpotlightModal/index.ts

This file was deleted.

27 changes: 0 additions & 27 deletions apps/ui/src/modals/SpotlightModal/spotlightStyle.css

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import TagsRow from './TagsRow'

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

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

import { useLocation, useNavigate, useParams } from 'react-router-dom'
import { useLocation, useNavigate } from 'react-router-dom'
import { useModal } from 'hooks'
import { AuthContext } from 'contexts'
import { StyledEditIcon } from 'pages/TeamOfAgents/TeamOfAgentsCard/TeamOfAgentsCard'
Expand All @@ -26,9 +25,10 @@ import MenuDots from '@l3-lib/ui-core/dist/icons/MenuDots'
import { useAgents } from 'pages/Agents/useAgents'
import { useGetAccountModule } from 'utils/useGetAccountModule'
import { useModelsService } from 'services'
import { AgentWithConfigs } from 'types'

type AgentViewDetailBoxProps = {
agentData: any
agentData: AgentWithConfigs
}

const AgentVIewDetailBox = ({ agentData }: AgentViewDetailBoxProps) => {
Expand Down Expand Up @@ -56,9 +56,7 @@ const AgentVIewDetailBox = ({ agentData }: AgentViewDetailBoxProps) => {

const isCreator = user?.id === agent?.created_by

const agentModel = models
?.filter((modelData: any) => modelData.id === model)
.map((model: any) => model.name)
const agentModel = models?.filter(modelData => modelData.id === model).map(model => model.name)

const handleEdit = () => {
closeModal('agent-view-modal')
Expand Down Expand Up @@ -158,7 +156,7 @@ const AgentVIewDetailBox = ({ agentData }: AgentViewDetailBoxProps) => {

{agentModel?.length > 0 && <TagsRow title={t('model')} items={agentModel} />}

{temperature && <TagsRow title={t('temperature')} items={[temperature]} />}
{temperature && <TagsRow title={t('temperature')} items={[temperature.toString()]} />}

<TagsRow title={t('template')} items={[is_template ? 'True' : 'False']} />
</StyledWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const useFineTuningForm = () => {
const { data: models } = useModelsService()

const modelOptions = models
?.filter((model: any) => model.fine_tuning === true)
?.filter(model => model.fine_tuning === true)
?.map(({ id, name, provider }) => ({
value: id,
label: `${name} (${provider})`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ const TeamOfAgentsDetailsBox = ({ teamData }: TeamOfAgentsDetailsBoxProps) => {
const { model, temperature } = configs
const isCreator = user?.id === created_by

const teamModel = models
?.filter((modelData: any) => modelData.id === model)
.map((model: any) => model.name)
const teamModel = models?.filter(modelData => modelData.id === model).map(model => model.name)

const handleEdit = () => {
closeModal('team-of-agent-view-modal')
Expand Down
13 changes: 0 additions & 13 deletions apps/ui/src/services/llm/useProvidersService.ts

This file was deleted.

4 changes: 2 additions & 2 deletions apps/ui/src/services/model/useModelsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { useQuery } from '@apollo/client'
import MODELS_GQL from '../../gql/ai/model/models.gql'
import { Model } from 'types'

type ModelsData = {
type UseModelsServiceData = {
models: Model[]
}

export const useModelsService = () => {
const { data, error, loading, refetch } = useQuery<ModelsData>(MODELS_GQL)
const { data, error, loading, refetch } = useQuery<UseModelsServiceData>(MODELS_GQL)

return {
data: data?.models || [],
Expand Down
1 change: 1 addition & 0 deletions apps/ui/src/types/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface AgentWithConfigs {
avatar: string
is_template: boolean
is_memory: boolean
created_by: string
}
configs: {
goals: string[]
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"typeRoots": ["node_modules/@types", "src/@types"],
"typeRoots": ["node_modules/@types", "src/@types", "./node_modules"],
"types": ["vite/client"]
},
"include": ["src", "Routes_old", "src/modals/AIChatModal/components/.tsx"],
Expand Down
7 changes: 7 additions & 0 deletions apps/ui/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2202,6 +2202,13 @@
dependencies:
"@types/react" "*"

"@types/react-table@^7.7.17":
version "7.7.17"
resolved "https://registry.yarnpkg.com/@types/react-table/-/react-table-7.7.17.tgz#4b58dee39d2bb585013536b519e6414591029c73"
integrity sha512-25/SDkn0qnvxBvxSPnMO1vf1ymvcSmwPr7qcFuYyWElTGcsOWQsV+sCFq1dVhGYdd2fSsOnP4MkZUl/q9MlG+g==
dependencies:
"@types/react" "*"

"@types/react-transition-group@^4.4.8":
version "4.4.8"
resolved "https://registry.yarnpkg.com/@types/react-transition-group/-/react-transition-group-4.4.8.tgz#46f87d80512959cac793ecc610a93d80ef241ccf"
Expand Down

0 comments on commit 2726802

Please sign in to comment.