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

Integrate custom instructions #248

Merged
merged 3 commits into from
Jul 8, 2024
Merged
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
Binary file not shown.
File renamed without changes.

This file was deleted.

This file was deleted.

3 changes: 2 additions & 1 deletion src/frontend/helpers/screens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export enum Screens {
SignUp = 'SignUp',
ForgotPassword = 'ForgotPassword',
ResetPassword = 'ResetPassword',
Chat = 'Chat'
Chat = 'Chat',
CustomInstructions = 'CustomInstructions'
}
8 changes: 7 additions & 1 deletion src/frontend/routes/MainRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { createDrawerNavigator } from '@react-navigation/drawer';
import React from 'react';
import { Header } from '../components';
import { Screens } from '../helpers';
import { ChatUI, DrawerMenu } from '../screens';
import { ChatUI, DrawerMenu, CustomInstructions } from '../screens';

export type MainDrawerParams = {
[Screens.Chat]: { chatId: string | null };
[Screens.CustomInstructions]: undefined;
};

const MainRouteDrawer = createDrawerNavigator<MainDrawerParams>();
Expand All @@ -18,6 +19,11 @@ export function MainRoutes() {
component={ChatUI}
options={{ header: (props) => <Header {...props} /> }}
/>
<MainRouteDrawer.Screen
name={Screens.CustomInstructions}
component={CustomInstructions}
options={{ header: (props) => <Header {...props} /> }}
/>
</MainRouteDrawer.Navigator>
);
}
25 changes: 25 additions & 0 deletions src/frontend/screens/CustomInstructions/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// src/frontend/screens/CustomInstructions.tsx
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import PersonalInfoForm from '../../components/PersonalInfoForm';

export function CustomInstructions() {
return (
<View style={styles.container}>
<Text style={styles.title}>Custom Instructions</Text>
<PersonalInfoForm />
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
padding: 16,
},
title: {
fontSize: 24,
fontWeight: 'bold',
marginBottom: 16,
},
});
8 changes: 7 additions & 1 deletion src/frontend/screens/DrawerMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
import { LLM_MODELS, useActiveChatId, useCreateChat, useGetAllChat } from 'src/frontend/hooks';
import type { AppRoutesParams } from 'src/frontend/routes';
import type { Chat } from 'src/frontend/types';
import { MainDrawerParams } from 'src/frontend/routes/MainRoutes';

Check failure on line 19 in src/frontend/screens/DrawerMenu/index.tsx

View workflow job for this annotation

GitHub Actions / Job: Check Lint and Format TS & TSX Code

All these imports are only used as types.
import { DrawerNavigationProp } from '@react-navigation/drawer';

Check failure on line 20 in src/frontend/screens/DrawerMenu/index.tsx

View workflow job for this annotation

GitHub Actions / Job: Check Lint and Format TS & TSX Code

All these imports are only used as types.



/**
* NOTE: needs to be called DrawerMenu because Drawer is already defined in react-native-paper
Expand All @@ -26,11 +30,13 @@
const { chats, status, error } = useGetAllChat();
const { reset } = useNavigation<NativeStackNavigationProp<AppRoutesParams>>();
const { colors } = useTheme();
const navigationC = useNavigation<DrawerNavigationProp<MainDrawerParams>>();

// ------------ Define navigation functions ------------
const goToProfile = () => {
//navigation.navigate('Profile');
console.log('TODO: implement Profile Screen');

navigate('Main', { screen: Screens.CustomInstructions });
};

const { navigate } = useNavigation<NativeStackNavigationProp<AppRoutesParams>>();
Expand Down
1 change: 1 addition & 0 deletions src/frontend/screens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export * from './DrawerMenu';
export * from './SignUp';
export * from './ForgotPassword';
export * from './ResetPassword';
export * from './CustomInstructions';
Loading