-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(frontend): implement new post message verification ui (#302)
- Loading branch information
Showing
25 changed files
with
361 additions
and
193 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
39 changes: 39 additions & 0 deletions
39
frontend/app/src/components/chat-engine/edit-token-form.tsx
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,39 @@ | ||
'use client'; | ||
|
||
import { type ChatEngine, type ChatEngineOptions, updateChatEngine } from '@/api/chat-engines'; | ||
import { EditPropertyForm } from '@/components/chat-engine/edit-property-form'; | ||
import { FormInput } from '@/components/form/control-widget'; | ||
import { useRefresh } from '@/components/nextjs/app-router-hooks'; | ||
import { toast } from 'sonner'; | ||
import { z } from 'zod'; | ||
|
||
type KeyOfType<T, Value> = keyof { [P in keyof T as T[P] extends Value ? P : never]: any } | ||
|
||
export interface EditNameFormProps<P extends KeyOfType<ChatEngineOptions, string | undefined | null>> { | ||
property: P; | ||
chatEngine: ChatEngine; | ||
} | ||
|
||
const stringSchema = z.string(); | ||
|
||
export function EditTokenForm<P extends KeyOfType<ChatEngineOptions, string | undefined | null>> ({ property, chatEngine }: EditNameFormProps<P>) { | ||
const [refreshing, refresh] = useRefresh(); | ||
|
||
return ( | ||
<EditPropertyForm | ||
inline | ||
object={chatEngine.engine_options} | ||
property={property} | ||
schema={stringSchema} | ||
onSubmit={async (data) => { | ||
const options = { ...chatEngine.engine_options, ...data }; | ||
await updateChatEngine(chatEngine.id, { engine_options: options }); | ||
refresh(); | ||
toast(`ChatEngine's ${property} successfully updated.`); | ||
}} | ||
disabled={refreshing} | ||
> | ||
<FormInput type="password" /> | ||
</EditPropertyForm> | ||
); | ||
} |
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,39 @@ | ||
'use client'; | ||
|
||
import { type ChatEngine, type ChatEngineOptions, updateChatEngine } from '@/api/chat-engines'; | ||
import { EditPropertyForm } from '@/components/chat-engine/edit-property-form'; | ||
import { FormInput } from '@/components/form/control-widget'; | ||
import { useRefresh } from '@/components/nextjs/app-router-hooks'; | ||
import { toast } from 'sonner'; | ||
import { z } from 'zod'; | ||
|
||
type KeyOfType<T, Value> = keyof { [P in keyof T as T[P] extends Value ? P : never]: any } | ||
|
||
export interface EditNameFormProps<P extends KeyOfType<ChatEngineOptions, string | undefined | null>> { | ||
property: P; | ||
chatEngine: ChatEngine; | ||
} | ||
|
||
const stringSchema = z.string().url(); | ||
|
||
export function EditUrlForm<P extends KeyOfType<ChatEngineOptions, string | undefined | null>> ({ property, chatEngine }: EditNameFormProps<P>) { | ||
const [refreshing, refresh] = useRefresh(); | ||
|
||
return ( | ||
<EditPropertyForm | ||
inline | ||
object={chatEngine.engine_options} | ||
property={property} | ||
schema={stringSchema} | ||
onSubmit={async (data) => { | ||
const options = { ...chatEngine.engine_options, ...data }; | ||
await updateChatEngine(chatEngine.id, { engine_options: options }); | ||
refresh(); | ||
toast(`ChatEngine's option ${property} successfully updated.`); | ||
}} | ||
disabled={refreshing} | ||
> | ||
<FormInput /> | ||
</EditPropertyForm> | ||
); | ||
} |
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
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.