-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: remove discussion prompt from summary #9711
Merged
nickoferrall
merged 6 commits into
master
from
chore/9710/remove-discussion-prompt-from-summary
May 8, 2024
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6a29060
chore: remove ai summary from discussion thread
nickoferrall 39e6545
remove discussion prompt from summary
nickoferrall 16f2ed3
refactor generate group summaries to generate discussion prompt
nickoferrall 2db042c
show loading in summary if there is more than one reflection
nickoferrall f213bc6
remove summary query from endRetro mutation
nickoferrall 4ee6228
remove promise all
nickoferrall File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -90,7 +90,6 @@ const RetroTopic = (props: Props) => { | |
reflections { | ||
...EmailReflectionCard_reflection | ||
} | ||
discussionPromptQuestion | ||
} | ||
discussion { | ||
commentCount | ||
|
@@ -121,7 +120,7 @@ const RetroTopic = (props: Props) => { | |
|
||
const {reflectionGroup, discussion, id: stageId} = stage | ||
const {commentCount, discussionSummary} = discussion | ||
const {reflections, title, voteCount, discussionPromptQuestion} = reflectionGroup! | ||
const {reflections, title, voteCount} = reflectionGroup! | ||
const imageSource = isEmail ? 'static' : 'local' | ||
const icon = imageSource === 'local' ? 'thumb_up_18.svg' : '[email protected]' | ||
const src = `${ExternalLinks.EMAIL_CDN}${icon}` | ||
|
@@ -143,29 +142,15 @@ const RetroTopic = (props: Props) => { | |
</AnchorIfEmail> | ||
</td> | ||
</tr> | ||
{(discussionPromptQuestion || discussionSummary) && ( | ||
{discussionSummary && ( | ||
<tr> | ||
<td align='left' style={{lineHeight: '22px', fontSize: 14}}> | ||
{discussionPromptQuestion && ( | ||
<> | ||
<tr> | ||
<td style={topicTitleStyle}>{'🤖 Discussion Question'}</td> | ||
</tr> | ||
<tr> | ||
<td style={textStyle}>{discussionPromptQuestion}</td> | ||
</tr> | ||
</> | ||
)} | ||
{discussionSummary && ( | ||
<> | ||
<tr> | ||
<td style={topicTitleStyle}>{'🤖 Discussion Summary'}</td> | ||
</tr> | ||
<tr> | ||
<td style={textStyle}>{discussionSummary}</td> | ||
</tr> | ||
</> | ||
)} | ||
<tr> | ||
<td style={topicTitleStyle}>{'🤖 Discussion Summary'}</td> | ||
</tr> | ||
<tr> | ||
<td style={textStyle}>{discussionSummary}</td> | ||
</tr> | ||
</td> | ||
</tr> | ||
)} | ||
|
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 |
---|---|---|
|
@@ -31,8 +31,12 @@ graphql` | |
autogroupReflectionGroups { | ||
groupTitle | ||
} | ||
organization { | ||
featureFlags { | ||
noAISummary | ||
} | ||
} | ||
reflectionGroups(sortBy: voteCount) { | ||
summary | ||
reflections { | ||
id | ||
} | ||
|
@@ -43,13 +47,6 @@ graphql` | |
} | ||
phases { | ||
phaseType | ||
... on DiscussPhase { | ||
stages { | ||
discussion { | ||
summary | ||
} | ||
} | ||
} | ||
} | ||
} | ||
team { | ||
|
@@ -109,7 +106,14 @@ export const endRetrospectiveTeamOnNext: OnNextHandler< | |
const {isKill, meeting} = payload | ||
const {atmosphere, history} = context | ||
if (!meeting) return | ||
const {id: meetingId, teamId, reflectionGroups, phases, autogroupReflectionGroups} = meeting | ||
const { | ||
id: meetingId, | ||
teamId, | ||
reflectionGroups, | ||
phases, | ||
autogroupReflectionGroups, | ||
organization | ||
} = meeting | ||
if (meetingId === RetroDemo.MEETING_ID) { | ||
if (isKill) { | ||
window.localStorage.removeItem('retroDemo') | ||
|
@@ -122,12 +126,9 @@ export const endRetrospectiveTeamOnNext: OnNextHandler< | |
history.push(`/team/${teamId}`) | ||
popEndMeetingToast(atmosphere, meetingId) | ||
} else { | ||
const discussPhase = phases.find((phase) => phase.phaseType === 'discuss') | ||
const {stages} = discussPhase ?? {} | ||
const hasTopicSummary = reflectionGroups.some((group) => group.summary) | ||
const reflections = reflectionGroups.flatMap((group) => group.reflections) // reflectionCount hasn't been calculated yet so check reflections length | ||
const hasDiscussionSummary = !!stages?.some((stage) => stage.discussion?.summary) | ||
const hasOpenAISummary = hasTopicSummary || hasDiscussionSummary | ||
const hasMoreThanOneReflection = reflections.length > 1 | ||
const hasOpenAISummary = hasMoreThanOneReflection || !organization.featureFlags.noAISummary | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -1 this should be |
||
const hasTeamHealth = phases.some((phase) => phase.phaseType === 'TEAM_HEALTH') | ||
const pathname = `/new-summary/${meetingId}` | ||
const search = new URLSearchParams() | ||
|
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 |
---|---|---|
|
@@ -5,7 +5,7 @@ import sendToSentry from '../../../utils/sendToSentry' | |
import {DataLoaderWorker} from '../../graphql' | ||
import canAccessAISummary from './canAccessAISummary' | ||
|
||
const generateGroupSummaries = async ( | ||
const generateDiscussionPrompt = async ( | ||
meetingId: string, | ||
teamId: string, | ||
dataLoader: DataLoaderWorker, | ||
|
@@ -30,7 +30,7 @@ const generateGroupSummaries = async ( | |
const pg = getKysely() | ||
const manager = new OpenAIServerManager() | ||
if (!reflectionGroups.length) { | ||
const error = new Error('No reflection groups in generateGroupSummaries') | ||
const error = new Error('No reflection groups in generateDiscussionPrompt') | ||
sendToSentry(error, {userId: facilitator.id, tags: {meetingId}}) | ||
return | ||
} | ||
|
@@ -40,30 +40,21 @@ const generateGroupSummaries = async ( | |
({reflectionGroupId}) => reflectionGroupId === group.id | ||
) | ||
if (reflectionsByGroupId.length <= 1) return | ||
const reflectionTextByGroupId = reflectionsByGroupId.map( | ||
({plaintextContent}) => plaintextContent | ||
) | ||
const [fullSummary, fullQuestion] = await Promise.all([ | ||
manager.getSummary(reflectionTextByGroupId), | ||
const [fullQuestion] = await Promise.all([ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -1 No need to wrap a single call in |
||
manager.getDiscussionPromptQuestion(group.title ?? 'Unknown', reflectionsByGroupId) | ||
]) | ||
if (!fullSummary && !fullQuestion) return | ||
const summary = fullSummary?.slice(0, 2000) | ||
if (!fullQuestion) return | ||
const discussionPromptQuestion = fullQuestion?.slice(0, 2000) | ||
return Promise.all([ | ||
pg | ||
.updateTable('RetroReflectionGroup') | ||
.set({summary, discussionPromptQuestion}) | ||
.set({discussionPromptQuestion}) | ||
.where('id', '=', group.id) | ||
.execute(), | ||
r | ||
.table('RetroReflectionGroup') | ||
.get(group.id) | ||
.update({summary, discussionPromptQuestion}) | ||
.run() | ||
r.table('RetroReflectionGroup').get(group.id).update({discussionPromptQuestion}).run() | ||
]) | ||
}) | ||
) | ||
} | ||
|
||
export default generateGroupSummaries | ||
export default generateDiscussionPrompt |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there's more than one reflection, we'll always create the meeting summary unless
noAISummary
is true, so we don't need to check if there's a discussion summary or reflection group summary (which is now removed anyway)