diff --git a/apps/webapp/src/modules/ai/conversation-item.tsx b/apps/webapp/src/modules/ai/conversation-item.tsx index d7e4d2af..6808367b 100644 --- a/apps/webapp/src/modules/ai/conversation-item.tsx +++ b/apps/webapp/src/modules/ai/conversation-item.tsx @@ -4,6 +4,7 @@ import { defaultExtensions } from '@tegonhq/ui/components/ui/editor/editor-exten import { AI } from '@tegonhq/ui/icons'; import { Editor } from '@tiptap/core'; import { observer } from 'mobx-react-lite'; +import getConfig from 'next/config'; import React, { useEffect, useRef } from 'react'; import type { ConversationHistoryType } from 'common/types'; @@ -20,6 +21,8 @@ interface AIConversationItemProps { conversationHistory: ConversationHistoryType; } +const { publicRuntimeConfig } = getConfig(); + export const ConversationItem = observer( ({ conversationHistory }: AIConversationItemProps) => { const { user } = useUserData(conversationHistory.userId); @@ -74,6 +77,7 @@ export const ConversationItem = observer( variant="secondary" onClick={() => { runTasks({ + baseHost: publicRuntimeConfig.NEXT_PUBLIC_AI_HOST, conversationId: conversationHistory.conversationId, conversationHistoryId: conversationHistory.id, workspaceId: workspace.id, diff --git a/apps/webapp/src/services/conversations/run-tasks.tsx b/apps/webapp/src/services/conversations/run-tasks.tsx index e819375c..ef48e8f0 100644 --- a/apps/webapp/src/services/conversations/run-tasks.tsx +++ b/apps/webapp/src/services/conversations/run-tasks.tsx @@ -8,6 +8,7 @@ interface MutationParams { onError?: (error: any) => void; } interface RunTasksProps { + baseHost: string; conversationId: string; conversationHistoryId: string; taskIds: string[]; @@ -15,13 +16,14 @@ interface RunTasksProps { } const runTasks = async ({ + baseHost, conversationId, conversationHistoryId, taskIds, workspaceId, }: RunTasksProps) => { return axios({ - url: `http://localhost:2000/chat`, + url: `${baseHost}/chat`, withCredentials: true, method: 'Post', data: {