-
Notifications
You must be signed in to change notification settings - Fork 421
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: MessageState.submittedFeedback state (#972)
- Loading branch information
Showing
13 changed files
with
70 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@assistant-ui/react": patch | ||
--- | ||
|
||
feat: MessageState.submittedFeedback state |
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
10 changes: 3 additions & 7 deletions
10
packages/react/src/primitive-hooks/actionBar/useActionBarFeedbackNegative.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 |
---|---|---|
@@ -1,16 +1,12 @@ | ||
import { useCallback } from "react"; | ||
import { useMessageRuntime, useMessageUtilsStore } from "../../context"; | ||
import { useMessageRuntime } from "../../context"; | ||
|
||
export const useActionBarFeedbackNegative = () => { | ||
const messageRuntime = useMessageRuntime(); | ||
const messageUtilsStore = useMessageUtilsStore(); | ||
|
||
const callback = useCallback(() => { | ||
messageRuntime.submitFeedback({ | ||
type: "negative", | ||
}); | ||
messageUtilsStore.getState().setSubmittedFeedback("negative"); | ||
}, [messageUtilsStore, messageRuntime]); | ||
messageRuntime.submitFeedback({ type: "negative" }); | ||
}, [messageRuntime]); | ||
|
||
return callback; | ||
}; |
10 changes: 3 additions & 7 deletions
10
packages/react/src/primitive-hooks/actionBar/useActionBarFeedbackPositive.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 |
---|---|---|
@@ -1,16 +1,12 @@ | ||
import { useCallback } from "react"; | ||
import { useMessageRuntime, useMessageUtilsStore } from "../../context"; | ||
import { useMessageRuntime } from "../../context"; | ||
|
||
export const useActionBarFeedbackPositive = () => { | ||
const messageRuntime = useMessageRuntime(); | ||
const messageUtilsStore = useMessageUtilsStore(); | ||
|
||
const callback = useCallback(() => { | ||
messageRuntime.submitFeedback({ | ||
type: "positive", | ||
}); | ||
messageUtilsStore.getState().setSubmittedFeedback("positive"); | ||
}, [messageUtilsStore, messageRuntime]); | ||
messageRuntime.submitFeedback({ type: "positive" }); | ||
}, [messageRuntime]); | ||
|
||
return callback; | ||
}; |
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