kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
fix: export and mark methods as protected
rodzic
1a283ef573
commit
e69aed20a4
|
@ -9,7 +9,7 @@ import { BaseTask } from '../task'
|
||||||
/**
|
/**
|
||||||
* Actions the user can take in the feedback selection prompt.
|
* Actions the user can take in the feedback selection prompt.
|
||||||
*/
|
*/
|
||||||
const UserActions = {
|
export const UserActions = {
|
||||||
Accept: 'accept',
|
Accept: 'accept',
|
||||||
Edit: 'edit',
|
Edit: 'edit',
|
||||||
Decline: 'decline',
|
Decline: 'decline',
|
||||||
|
@ -17,7 +17,7 @@ const UserActions = {
|
||||||
Exit: 'exit'
|
Exit: 'exit'
|
||||||
} as const
|
} as const
|
||||||
|
|
||||||
type UserActions = (typeof UserActions)[keyof typeof UserActions]
|
export type UserActions = (typeof UserActions)[keyof typeof UserActions]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Messages to display to the user for each action.
|
* Messages to display to the user for each action.
|
||||||
|
@ -37,7 +37,7 @@ async function askUser(
|
||||||
message: string,
|
message: string,
|
||||||
choices: UserActions[]
|
choices: UserActions[]
|
||||||
): Promise<UserActions> {
|
): Promise<UserActions> {
|
||||||
return await select({
|
return select({
|
||||||
message,
|
message,
|
||||||
choices: choices.map((choice) => ({
|
choices: choices.map((choice) => ({
|
||||||
name: UserActionMessages[choice],
|
name: UserActionMessages[choice],
|
||||||
|
@ -62,7 +62,7 @@ export class HumanFeedbackSingle<T extends ZodTypeAny> extends BaseTask<
|
||||||
ZodTypeAny,
|
ZodTypeAny,
|
||||||
ZodTypeAny
|
ZodTypeAny
|
||||||
> {
|
> {
|
||||||
private choiceSchema: T
|
protected choiceSchema: T
|
||||||
|
|
||||||
constructor(choiceSchema: T) {
|
constructor(choiceSchema: T) {
|
||||||
super()
|
super()
|
||||||
|
@ -77,7 +77,7 @@ export class HumanFeedbackSingle<T extends ZodTypeAny> extends BaseTask<
|
||||||
return FeedbackSingleOutputSchema(this.choiceSchema)
|
return FeedbackSingleOutputSchema(this.choiceSchema)
|
||||||
}
|
}
|
||||||
|
|
||||||
private actionHandlers = {
|
protected actionHandlers = {
|
||||||
[UserActions.Accept]: (
|
[UserActions.Accept]: (
|
||||||
input: types.ParsedData<typeof this.inputSchema>
|
input: types.ParsedData<typeof this.inputSchema>
|
||||||
) => ({ result: input, accepted: true }),
|
) => ({ result: input, accepted: true }),
|
||||||
|
@ -146,7 +146,7 @@ export class HumanFeedbackSelect<T extends ZodTypeAny> extends BaseTask<
|
||||||
ZodTypeAny,
|
ZodTypeAny,
|
||||||
ZodTypeAny
|
ZodTypeAny
|
||||||
> {
|
> {
|
||||||
private choiceSchema: T
|
protected choiceSchema: T
|
||||||
|
|
||||||
constructor(choiceSchema: T) {
|
constructor(choiceSchema: T) {
|
||||||
super()
|
super()
|
||||||
|
@ -161,7 +161,7 @@ export class HumanFeedbackSelect<T extends ZodTypeAny> extends BaseTask<
|
||||||
return FeedbackSelectOutputSchema(this.choiceSchema)
|
return FeedbackSelectOutputSchema(this.choiceSchema)
|
||||||
}
|
}
|
||||||
|
|
||||||
private actionHandlers = {
|
protected actionHandlers = {
|
||||||
[UserActions.Accept]: (
|
[UserActions.Accept]: (
|
||||||
input: types.ParsedData<typeof this.inputSchema>
|
input: types.ParsedData<typeof this.inputSchema>
|
||||||
) => ({ results: input, accepted: true }),
|
) => ({ results: input, accepted: true }),
|
||||||
|
|
Ładowanie…
Reference in New Issue