-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f82fbaa
commit 37f3645
Showing
21 changed files
with
407 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* This file was automatically generated by Payload. | ||
* DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config, | ||
* and re-run `payload generate:types` to regenerate this file. | ||
*/ | ||
|
||
export interface Config { | ||
auth: { | ||
users: UserAuthOperations; | ||
}; | ||
collections: { | ||
chats: Chat; | ||
users: User; | ||
'payload-locked-documents': PayloadLockedDocument; | ||
'payload-preferences': PayloadPreference; | ||
'payload-migrations': PayloadMigration; | ||
}; | ||
db: { | ||
defaultIDType: string; | ||
}; | ||
globals: {}; | ||
locale: null; | ||
user: User & { | ||
collection: 'users'; | ||
}; | ||
} | ||
export interface UserAuthOperations { | ||
forgotPassword: { | ||
email: string; | ||
password: string; | ||
}; | ||
login: { | ||
email: string; | ||
password: string; | ||
}; | ||
registerFirstUser: { | ||
email: string; | ||
password: string; | ||
}; | ||
unlock: { | ||
email: string; | ||
password: string; | ||
}; | ||
} | ||
/** | ||
* This interface was referenced by `Config`'s JSON-Schema | ||
* via the `definition` "chats". | ||
*/ | ||
export interface Chat { | ||
messages: { | ||
sent?: string | null; | ||
role: 'assistant' | 'user'; | ||
text: string; | ||
collection?: string | null; | ||
view?: ('list' | 'record') | null; | ||
id?: string | null; | ||
}[]; | ||
user: number | User; | ||
description?: string | null; | ||
updatedAt: string; | ||
createdAt: string; | ||
} | ||
/** | ||
* This interface was referenced by `Config`'s JSON-Schema | ||
* via the `definition` "users". | ||
*/ | ||
export interface User { | ||
updatedAt: string; | ||
createdAt: string; | ||
email: string; | ||
resetPasswordToken?: string | null; | ||
resetPasswordExpiration?: string | null; | ||
salt?: string | null; | ||
hash?: string | null; | ||
loginAttempts?: number | null; | ||
lockUntil?: string | null; | ||
password?: string | null; | ||
} | ||
/** | ||
* This interface was referenced by `Config`'s JSON-Schema | ||
* via the `definition` "payload-locked-documents". | ||
*/ | ||
export interface PayloadLockedDocument { | ||
document?: | ||
| ({ | ||
relationTo: 'chats'; | ||
value: number | Chat; | ||
} | null) | ||
| ({ | ||
relationTo: 'users'; | ||
value: number | User; | ||
} | null); | ||
globalSlug?: string | null; | ||
user: { | ||
relationTo: 'users'; | ||
value: number | User; | ||
}; | ||
updatedAt: string; | ||
createdAt: string; | ||
} | ||
/** | ||
* This interface was referenced by `Config`'s JSON-Schema | ||
* via the `definition` "payload-preferences". | ||
*/ | ||
export interface PayloadPreference { | ||
user: { | ||
relationTo: 'users'; | ||
value: number | User; | ||
}; | ||
key?: string | null; | ||
value?: | ||
| { | ||
[k: string]: unknown; | ||
} | ||
| unknown[] | ||
| string | ||
| number | ||
| boolean | ||
| null; | ||
updatedAt: string; | ||
createdAt: string; | ||
} | ||
/** | ||
* This interface was referenced by `Config`'s JSON-Schema | ||
* via the `definition` "payload-migrations". | ||
*/ | ||
export interface PayloadMigration { | ||
name?: string | null; | ||
batch?: number | null; | ||
updatedAt: string; | ||
createdAt: string; | ||
} | ||
/** | ||
* This interface was referenced by `Config`'s JSON-Schema | ||
* via the `definition` "auth". | ||
*/ | ||
export interface Auth { | ||
[k: string]: unknown; | ||
} | ||
|
||
|
||
declare module 'payload' { | ||
export interface GeneratedTypes extends Config {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import path from "node:path"; | ||
import {fileURLToPath} from "node:url"; | ||
import type {Config} from 'payload' | ||
import {buildConfig} from 'payload' | ||
import {chatPlugin} from "./plugin/ChatPlugin"; | ||
const filename = fileURLToPath(import.meta.url) | ||
const dirname = path.dirname(filename) | ||
|
||
export default buildConfig({ | ||
collections: [], | ||
db: {} as Config['db'], | ||
secret: 'secret', | ||
typescript: { | ||
outputFile: path.resolve(dirname, 'payload-types.ts'), | ||
}, | ||
plugins:[chatPlugin({})] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {cookies, headers} from "next/headers"; | ||
import payload, {extractJWT} from "payload"; | ||
|
||
export const getUser =()=>{ | ||
|
||
const jwt = extractJWT({headers: headers(), payload:payload, isGraphQL:false}) | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use client' | ||
import * as React from 'react' | ||
import {insertMessageAction} from './insertMessage.action' | ||
|
||
interface ChatId { | ||
chatId?: string | number | ||
} | ||
|
||
export const SendMessageUI = ({ chatId }: ChatId) => { | ||
return ( | ||
<form id="chat" className="flex" action={insertMessageAction}> | ||
<label htmlFor="message" className="sr-only"> | ||
Input Your Query | ||
</label> | ||
<input | ||
name="message" | ||
id="message" | ||
className="flex-grow p-2 border border-gray-300 rounded-l" | ||
placeholder="Type your message..." | ||
/> | ||
<input hidden id="chatId" name="chatId" readOnly value={chatId} /> | ||
<button type="submit" className="p-2 bg-blue-500 text-white rounded-r"> | ||
Send | ||
</button> | ||
</form> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.