Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 53905f6

Browse files
authored
FEATURE: add participants and invite button to AI conversations (#1354)
1 parent ef260be commit 53905f6

File tree

4 files changed

+153
-11
lines changed

4 files changed

+153
-11
lines changed

assets/javascripts/discourse/connectors/topic-map-expanded-after/ai-summary-trigger.gjs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import AiSummaryModal from "../../components/modal/ai-summary-modal";
77
export default class AiSummaryTrigger extends Component {
88
@service modal;
99

10+
get isAiConversation() {
11+
return this.args.outletArgs.topic.is_bot_pm;
12+
}
13+
1014
@action
1115
openAiSummaryModal() {
1216
this.modal.show(AiSummaryModal, {
@@ -18,15 +22,17 @@ export default class AiSummaryTrigger extends Component {
1822
}
1923

2024
<template>
21-
{{#if @outletArgs.topic.summarizable}}
22-
<section class="topic-map__additional-contents toggle-summary">
23-
<DButton
24-
@label="summary.buttons.generate"
25-
@icon="discourse-sparkles"
26-
@action={{this.openAiSummaryModal}}
27-
class="btn-default ai-summarization-button"
28-
/>
29-
</section>
30-
{{/if}}
25+
{{#unless this.isAiConversation}}
26+
{{#if @outletArgs.topic.summarizable}}
27+
<section class="topic-map__additional-contents toggle-summary">
28+
<DButton
29+
@label="summary.buttons.generate"
30+
@icon="discourse-sparkles"
31+
@action={{this.openAiSummaryModal}}
32+
class="btn-default ai-summarization-button"
33+
/>
34+
</section>
35+
{{/if}}
36+
{{/unless}}
3137
</template>
3238
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import Component from "@glimmer/component";
2+
import { action } from "@ember/object";
3+
import { service } from "@ember/service";
4+
import { or } from "truth-helpers";
5+
import DButton from "discourse/components/d-button";
6+
import Participant from "discourse/components/header/topic/participant";
7+
import AddPmParticipants from "discourse/components/modal/add-pm-participants";
8+
9+
export default class AiConversationInvite extends Component {
10+
static shouldRender(args) {
11+
return args.topic.is_bot_pm;
12+
}
13+
14+
@service site;
15+
@service modal;
16+
@service header;
17+
@service sidebarState;
18+
19+
get participants() {
20+
const participants = [
21+
...this.header.topicInfo.details.allowed_users,
22+
...this.header.topicInfo.details.allowed_groups,
23+
];
24+
return participants;
25+
}
26+
27+
@action
28+
showInvite() {
29+
this.modal.show(AddPmParticipants, {
30+
model: {
31+
title: "discourse_ai.ai_bot.invite_ai_conversation.title",
32+
inviteModel: this.args.outletArgs.topic,
33+
},
34+
});
35+
}
36+
37+
<template>
38+
<div class="ai-conversation__participants">
39+
<DButton
40+
@icon="user-plus"
41+
@label="discourse_ai.ai_bot.invite_ai_conversation.button"
42+
@action={{this.showInvite}}
43+
class="btn-default ai-conversations__invite-button"
44+
/>
45+
{{#each this.participants as |participant|}}
46+
<Participant
47+
@user={{participant}}
48+
@type={{if participant.username "user" "group"}}
49+
@username={{or participant.username participant.name}}
50+
@avatarSize="medium"
51+
/>
52+
{{/each}}
53+
</div>
54+
</template>
55+
}

assets/stylesheets/modules/ai-bot-conversations/common.scss

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ body.has-ai-conversations-sidebar {
7878
.private-message-glyph-wrapper,
7979
.topic-header-participants,
8080
.topic-above-footer-buttons-outlet,
81-
.topic-map,
8281
#topic-footer-buttons .topic-footer-main-buttons details {
8382
display: none;
8483
}
@@ -455,4 +454,82 @@ body.has-ai-conversations-sidebar {
455454
display: none;
456455
}
457456
}
457+
458+
.topic-map {
459+
box-sizing: border-box;
460+
width: 100%;
461+
margin: 0 auto;
462+
padding-block: 0.5em;
463+
464+
.topic-map__views-trigger,
465+
.topic-map__likes-trigger,
466+
.summarization-button,
467+
&__private-message-map,
468+
.topic-map__users-list {
469+
display: none;
470+
}
471+
472+
&.--bottom {
473+
padding-top: 0;
474+
}
475+
476+
section {
477+
background: transparent;
478+
border-block: 1px solid var(--primary-low);
479+
}
480+
481+
&__contents {
482+
padding: 0.5em 1.25em;
483+
484+
@include viewport.from(sm) {
485+
padding: 0.5em 0.5em 0.5em 1.9em;
486+
}
487+
}
488+
489+
&__stats {
490+
height: 100%;
491+
flex-wrap: nowrap;
492+
gap: 1em;
493+
}
494+
495+
.ai-conversation__participants {
496+
display: flex;
497+
flex-wrap: wrap;
498+
gap: 0.5em 0.25em;
499+
align-items: center;
500+
501+
.avatar {
502+
width: 2em;
503+
height: 2em;
504+
}
505+
506+
.trigger-group-card {
507+
display: flex;
508+
align-items: center;
509+
border: 1px solid var(--primary-low);
510+
border-radius: var(--d-button-border-radius);
511+
padding: 0.25em 0.5em;
512+
font-size: var(--font-down-1);
513+
514+
span {
515+
position: relative;
516+
top: -1px;
517+
}
518+
519+
.d-icon {
520+
position: relative;
521+
top: 1px;
522+
}
523+
524+
a {
525+
color: var(--primary-medium);
526+
}
527+
}
528+
529+
.btn {
530+
font-size: var(--font-down-1);
531+
margin-right: 0.5em;
532+
}
533+
}
534+
}
458535
}

config/locales/client.en.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,10 @@ en:
712712
name: "Share AI conversation"
713713
title: "Share this AI conversation publicly"
714714

715+
invite_ai_conversation:
716+
button: "Invite"
717+
title: "Invite to AI conversation"
718+
715719
ai_label: "AI"
716720
ai_title: "Conversation with AI"
717721

0 commit comments

Comments
 (0)