Skip to content

Commit

Permalink
chore: remove ai summary from discussion thread (#9708)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickoferrall authored May 8, 2024
1 parent 881546c commit 2123159
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import {AIExplainer} from '../../../../client/types/constEnums'
import {PARABOL_AI_USER_ID} from '../../../../client/utils/constants'
import getRethink from '../../../database/rethinkDriver'
import Comment from '../../../database/types/Comment'
import DiscussStage from '../../../database/types/DiscussStage'
import {convertHtmlToTaskContent} from '../../../utils/draftjs/convertHtmlToTaskContent'
import {DataLoaderWorker} from '../../graphql'
import {getFeatureTier} from '../../types/helpers/getFeatureTier'

export const buildCommentContentBlock = (
title: string,
Expand All @@ -28,33 +26,17 @@ export const createAIComment = (discussionId: string, content: string, order: nu
const addAIGeneratedContentToThreads = async (
stages: DiscussStage[],
meetingId: string,
teamId: string,
dataLoader: DataLoaderWorker
) => {
const [r, groups, team] = await Promise.all([
const [r, groups] = await Promise.all([
getRethink(),
dataLoader.get('retroReflectionGroupsByMeetingId').load(meetingId),
dataLoader.get('teams').loadNonNull(teamId)
dataLoader.get('retroReflectionGroupsByMeetingId').load(meetingId)
])
const commentPromises = stages.map(async ({discussionId, reflectionGroupId}, idx) => {
const commentPromises = stages.map(async ({discussionId, reflectionGroupId}) => {
const group = groups.find((group) => group.id === reflectionGroupId)
if (!group?.summary && !group?.discussionPromptQuestion) return
if (!group?.discussionPromptQuestion) return
const comments: Comment[] = []

if (group.summary) {
const topicSummaryExplainerText =
idx === 0
? getFeatureTier(team) === 'starter'
? AIExplainer.STARTER
: AIExplainer.PREMIUM_REFLECTIONS
: undefined
const topicSummaryComment = createAIComment(
discussionId,
buildCommentContentBlock('🤖 Topic Summary', group.summary, topicSummaryExplainerText),
0
)
comments.push(topicSummaryComment)
}
if (group.discussionPromptQuestion) {
const topicSummaryComment = createAIComment(
discussionId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const handleCompletedRetrospectiveStage = async (
}))
await Promise.all([
insertDiscussions(discussions),
addAIGeneratedContentToThreads(discussPhaseStages, meetingId, teamId, dataLoader),
addAIGeneratedContentToThreads(discussPhaseStages, meetingId, dataLoader),
publishToEmbedder({jobType: 'relatedDiscussions:start', data: {meetingId}, priority: 0})
])
if (videoMeetingURL) {
Expand Down

0 comments on commit 2123159

Please sign in to comment.