Skip to content

Commit

Permalink
inform Feedback type. Submit positive feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
buddy-web3 committed May 9, 2024
1 parent 662a277 commit f08ffc3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/components/Feedback/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ const Feedback = ({
showText={!!labels}
actionType={ActionType.HELPFUL}
hint={upHint}
onClick={() => setShowFeedback(true)}
onClick={() => {
setShowFeedback(true)
onSubmit && onSubmit('', '')
}}
/>
<Action
pageid={pageid}
Expand Down
2 changes: 1 addition & 1 deletion app/routes/chat.log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const action = async ({request}: ActionFunctionArgs) => {
formData.append('file', fileBlob, 'question_and_response.html')

const info = [
option?.length > 0 ? ['Feedback type', 'Thumbs down'] : ['Feedback type', 'Thumbs UP'],
['Type', type],
['Pageid', pageid && `[${pageid}](https://aisafety.info/questions/${pageid}/${question})`],
['Selected option', option],
Expand All @@ -42,7 +43,6 @@ export const action = async ({request}: ActionFunctionArgs) => {
.map(([item, val]) => `* ${item} - ${val}`)
.join('\n')
formData.append('payload_json', JSON.stringify({content: `Chat feedback:\n${info}`}))

const DISCORD_LOGGING_URL = `https://discord.com/api/webhooks/${DISCORD_LOGGING_CHANNEL_ID}/${DISCORD_LOGGING_TOKEN}`
const response = await fetch(`${DISCORD_LOGGING_URL}`, {method: 'POST', body: formData})
if (!response.ok) {
Expand Down

0 comments on commit f08ffc3

Please sign in to comment.