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

mHealth uiuc-chatbot #190

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
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 package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "uiuc-chat-frontend",
"name": "mhealth-uiuc-chat-frontend",
"version": "0.1.0",
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chat/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export const Chat = memo(
try {
// Log conversation to our Flask Backend (especially Nomic)
const response = await fetch(
`https://flask-production-751b.up.railway.app/onResponseCompletion`,
`https://flask-pr-316.up.railway.app/onResponseCompletion`,
{
method: 'POST',
headers: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chat/NewChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export const Chat = memo(({ stopConversationRef, courseMetadata }: Props) => {
try {
// Log conversation to our Flask Backend (especially Nomic)
const response = await fetch(
`https://flask-production-751b.up.railway.app/onResponseCompletion`,
`https://flask-pr-316.up.railway.app/onResponseCompletion`,
{
method: 'POST',
headers: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/UIUC-Components/MakeQueryAnalysisPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ const CourseFilesList = ({ files }: CourseFilesListProps) => {
const handleDelete = async (s3_path: string, course_name: string) => {
try {
const response = await axios.delete(
`https://flask-production-751b.up.railway.app/delete`,
`https://flask-pr-316.up.railway.app/delete`,
{
params: { s3_path, course_name },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@

// const handleDelete = async (recordsToDelete: CourseDocument[]) => {
// try {
// const API_URL = 'https://flask-production-751b.up.railway.app'
// const API_URL = 'https://flask-pr-316.up.railway.app'
// const deletePromises = recordsToDelete.map((record) =>
// axios.delete(`${API_URL}/delete`, {
// params: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/UIUC-Components/ProjectFilesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ export function ProjectFilesTable({
const deleteDocumentMutation = useMutation({
mutationFn: async (recordsToDelete: CourseDocument[]) => {
console.debug('Deleting records:', recordsToDelete)
const API_URL = 'https://flask-production-751b.up.railway.app'
const API_URL = 'https://flask-pr-316.up.railway.app'
const deletePromises = recordsToDelete.map((record) =>
axios.delete(`${API_URL}/delete`, {
params: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/UIUC-Components/WebScrape.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ export const WebScrape = ({
if (!url || !courseName || !localDir) return null
console.log('calling downloadMITCourse')
const response = await axios.get(
`https://flask-production-751b.up.railway.app/mit-download`,
`https://flask-pr-316.up.railway.app/mit-download`,
{
params: {
url: url,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/[course_name]/tools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const ToolsPage: NextPage = () => {
setCourseExists(data)
if (data) {
const response = await fetch(
`https://flask-production-751b.up.railway.app/getAll?course_name=${course_name}`,
`https://flask-pr-316.up.railway.app/getAll?course_name=${course_name}`,
)
const data = await response.json()
const courseData = data.distinct_files
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/UIUC-api/createProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const createProject = async (
project_description: project_description,
project_owner_email: project_owner_email,
}
const url = 'https://flask-production-751b.up.railway.app/createProject'
const url = 'https://flask-pr-316.up.railway.app/createProject'

try {
const response = await fetch(url, {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/UIUC-api/downloadConvoHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const downloadConversationHistory = async (
): Promise<DownloadResult> => {
try {
const response = await axios.get(
`https://flask-production-751b.up.railway.app/export-convo-history?course_name=${courseName}`,
`https://flask-pr-316.up.railway.app/export-convo-history?course_name=${courseName}`,
{ responseType: 'blob' },
)

Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/UIUC-api/downloadConvoHistoryUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const downloadConversationHistoryUser = async (
)
try {
const response = await axios.get(
`https://flask-production-751b.up.railway.app/export-convo-history-user?user_email=${userEmail}&project_name=${projectName}`,
`https://flask-pr-316.up.railway.app/export-convo-history-user?user_email=${userEmail}&project_name=${projectName}`,
{ responseType: 'blob' },
)
console.log('Received response:', response)
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/UIUC-api/exportAllDocuments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const handleExport = async (
): Promise<ExportResult> => {
try {
const API_URL =
'https://flask-production-751b.up.railway.app/exportDocuments'
'https://flask-pr-316.up.railway.app/exportDocuments'
const response = await axios.get(`${API_URL}?course_name=${course_name}`, {
responseType: 'blob',
})
Expand Down
1 change: 1 addition & 0 deletions src/pages/api/buildPrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { NextApiRequest, NextApiResponse } from 'next'
import { ChatBody } from '@/types/chat'
import { buildPrompt } from '~/app/utils/buildPromptUtils'


export default async function handler(
req: NextApiRequest,
res: NextApiResponse,
Expand Down
2 changes: 2 additions & 0 deletions src/pages/api/chat-api/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ import { fetchEnabledDocGroups } from '~/utils/dbUtils'
import { buildPrompt } from '~/app/utils/buildPromptUtils'

export const maxDuration = 60


/**
* The chat API endpoint for handling chat requests and streaming/non streaming responses.
* This function orchestrates the validation of the request, user permissions,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/getContexts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const fetchContexts = async (
// ]
// return dummyContexts

const url = `https://flask-production-751b.up.railway.app/getTopContexts`
const url = `https://flask-pr-316.up.railway.app/getTopContexts`

try {
const response = await fetch(url, {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/getNomicMapForQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default async function handler(req: NextRequest, res: NextResponse) {
const course_name = req.nextUrl.searchParams.get('course_name')

const response = await fetch(
`https://flask-production-751b.up.railway.app/getNomicMap?course_name=${course_name}`,
`https://flask-pr-316.up.railway.app/getNomicMap?course_name=${course_name}`,
)
const data = await response.json()

Expand Down
4 changes: 2 additions & 2 deletions src/utils/functionCalling/handleFunctionCalling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ const callN8nFunction = async (

const timeStart = Date.now()
const response: Response = await fetch(
`https://flask-production-751b.up.railway.app/run_flow`,
`https://flask-pr-316.up.railway.app/run_flow`,
{
method: 'POST',
headers: {
Expand Down Expand Up @@ -469,7 +469,7 @@ export async function fetchTools(
const parsedPagination = pagination.toLowerCase() === 'true'

const response = await fetch(
`https://flask-production-751b.up.railway.app/getworkflows?api_key=${api_key}&limit=${limit}&pagination=${parsedPagination}`,
`https://flask-pr-316.up.railway.app/getworkflows?api_key=${api_key}&limit=${limit}&pagination=${parsedPagination}`,
)
if (!response.ok) {
// return res.status(response.status).json({ error: response.statusText })
Expand Down