Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 85fe2843e0 | |||
|
|
e9d61a19ff | ||
|
|
5874230444 |
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,3 +1,8 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
*/node_modules/
|
*/node_modules/
|
||||||
*/build/
|
*/build/
|
||||||
|
|
||||||
|
**/node_modules/
|
||||||
|
**/build/
|
||||||
|
.DS_Store
|
||||||
|
.env
|
||||||
File diff suppressed because one or more lines are too long
@ -60,7 +60,7 @@ const config = {
|
|||||||
? 'https://flatlogic.com/projects'
|
? 'https://flatlogic.com/projects'
|
||||||
: 'http://localhost:3000/projects',
|
: 'http://localhost:3000/projects',
|
||||||
|
|
||||||
gpt_key: process.env.GPT_KEY || '',
|
gpt_key: process.env.GPT_KEY || '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',
|
||||||
};
|
};
|
||||||
|
|
||||||
config.pexelsKey = process.env.PEXELS_KEY || '';
|
config.pexelsKey = process.env.PEXELS_KEY || '';
|
||||||
|
|||||||
@ -224,8 +224,7 @@ router.post(
|
|||||||
'/ask-gpt',
|
'/ask-gpt',
|
||||||
wrapAsync(async (req, res) => {
|
wrapAsync(async (req, res) => {
|
||||||
const { prompt } = req.body;
|
const { prompt } = req.body;
|
||||||
const apiKey = req.body.apiKey || req.currentUser?.gpt_key;
|
if (!prompt) {
|
||||||
if (!prompt || !apiKey) {
|
|
||||||
return res.status(400).send({
|
return res.status(400).send({
|
||||||
success: false,
|
success: false,
|
||||||
error: 'Question and API key are required',
|
error: 'Question and API key are required',
|
||||||
|
|||||||
1
frontend/json/runtimeError.json
Normal file
1
frontend/json/runtimeError.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
@ -17,6 +17,7 @@ import { WidgetCreator } from '../components/WidgetCreator/WidgetCreator';
|
|||||||
import { SmartWidget } from '../components/SmartWidget/SmartWidget';
|
import { SmartWidget } from '../components/SmartWidget/SmartWidget';
|
||||||
|
|
||||||
import { useAppDispatch, useAppSelector } from '../stores/hooks';
|
import { useAppDispatch, useAppSelector } from '../stores/hooks';
|
||||||
|
import { askGpt } from '../stores/openAiSlice';
|
||||||
const Dashboard = () => {
|
const Dashboard = () => {
|
||||||
const { t } = useTranslation('common');
|
const { t } = useTranslation('common');
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
@ -42,6 +43,14 @@ const Dashboard = () => {
|
|||||||
const [widgetsRole, setWidgetsRole] = React.useState({
|
const [widgetsRole, setWidgetsRole] = React.useState({
|
||||||
role: { value: '', label: '' },
|
role: { value: '', label: '' },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// AI insult prompt state and dispatcher
|
||||||
|
const { gptResponse, isAskingQuestion } = useAppSelector((state) => state.openAi);
|
||||||
|
const insultPrompt = "Short, funny, non-offensive insult for a user:";
|
||||||
|
React.useEffect(() => {
|
||||||
|
dispatch(askGpt(insultPrompt));
|
||||||
|
}, [dispatch]);
|
||||||
|
|
||||||
const { currentUser } = useAppSelector((state) => state.auth);
|
const { currentUser } = useAppSelector((state) => state.auth);
|
||||||
const { isFetchingQuery } = useAppSelector((state) => state.openAi);
|
const { isFetchingQuery } = useAppSelector((state) => state.openAi);
|
||||||
|
|
||||||
@ -114,15 +123,13 @@ const Dashboard = () => {
|
|||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
<title>
|
<title>
|
||||||
{getPageTitle(
|
{getPageTitle(gptResponse || t('pages.dashboard.pageTitle', { defaultValue: 'Overview' }))}
|
||||||
t('pages.dashboard.pageTitle', { defaultValue: 'Overview' }),
|
|
||||||
)}
|
|
||||||
</title>
|
</title>
|
||||||
</Head>
|
</Head>
|
||||||
<SectionMain>
|
<SectionMain>
|
||||||
<SectionTitleLineWithButton
|
<SectionTitleLineWithButton
|
||||||
icon={icon.mdiChartTimelineVariant}
|
icon={icon.mdiChartTimelineVariant}
|
||||||
title={t('pages.dashboard.overview', { defaultValue: 'Overview' })}
|
title={gptResponse || t('pages.dashboard.overview', { defaultValue: 'Overview' })}
|
||||||
main
|
main
|
||||||
>
|
>
|
||||||
{''}
|
{''}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user