Skip to content

Commit

Permalink
reset memories resets the FTU
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Mar 9, 2024
1 parent e4ec381 commit 1041b4e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
8 changes: 7 additions & 1 deletion packages/agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,15 @@ const routes: Route[] = [

const accountData = await runtime.databaseAdapter.getAccountById(message.user_id)

console.log('accountData', accountData)

if (!accountData) {
return new Response('Account not found', { status: 404 })
}

const userName = accountData[0].name || 'the user'
const userName = accountData.name || 'the user'

console.log('userName', userName)

const newGoal: Goal = {
name: 'First Time User Introduction (HIGH PRIORITY)',
Expand Down Expand Up @@ -402,6 +406,8 @@ const routes: Route[] = [
room_id
})

console.log('handling message', newMessage)

event.waitUntil(handleMessage(runtime, newMessage))

return new Response('ok', { status: 200 })
Expand Down
19 changes: 17 additions & 2 deletions packages/app/src/pages/app/FriendProfile/index.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import { Button, Container, Group, Text, useMantineTheme } from "@mantine/core"
import { showNotification } from "@mantine/notifications"
import { useSupabaseClient } from "@supabase/auth-helpers-react"
import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react"
import React from "react"
import { useNavigate } from "react-router-dom"
import { type JSX } from "react/jsx-runtime"
import { type Database } from "../../../../types/database.types"
import useHandleFriendsRequests from "../../../Hooks/relationships/useHandleFriendRequests"
import UserAvatar from "../../../components/UserAvatar"
import { getAvatarImage } from "../../../helpers/getAvatarImage"
import useGlobalStore from "../../../store/useGlobalStore"
import MainLayout from "../MainLayout.tsx"
import useRoomStyles from "../Room/useRoomStyles"
import { type JSX } from "react/jsx-runtime"

export default function Profile (): JSX.Element {
const navigate = useNavigate()
// const isMobile = useMediaQuery("(max-width: 900px)")
const supabase = useSupabaseClient<Database>()
const { classes: roomClasses } = useRoomStyles()
const { user } = useGlobalStore()
const session = useSession()

const {
currentRoom: {
Expand Down Expand Up @@ -63,6 +64,20 @@ export default function Profile (): JSX.Element {
const { error: goalsError } = await supabase.from("goals").delete().eq("user_ids", userIdsArray)
if (goalsError) console.error(goalsError)

const serverUrl = import.meta?.env?.REACT_APP_SERVER_URL || import.meta?.env?.VITE_SERVER_URL || "https://cojourney.shawmakesmagic.workers.dev/api/agents/newuser"

await fetch(serverUrl as string, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + session?.access_token
},
body: JSON.stringify({
user_id: userId,
token: session?.access_token
})
})

showNotification({
title: "Memories reset",
message: "Memories have been reset successfully",
Expand Down

0 comments on commit 1041b4e

Please sign in to comment.