Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions components/Comment/CommentItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,9 @@ export const CommentItem = ({
}

.prose pre code {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono',
'Courier New', monospace;
font-family:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really tiny but some weird spacing thing is happening?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like pre-commit does this.

ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
monospace;
font-size: 0.875rem;
line-height: 1.5;
background: none;
Expand Down
16 changes: 16 additions & 0 deletions components/Feed/FeedItemHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { Work } from '@/types/work';
import { TrendingUp } from 'lucide-react';
import { ImpactScoreTooltip } from '@/components/tooltips/ImpactScoreTooltip';
import { User } from '@/types/user';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faMicrochipAi } from '@fortawesome/pro-light-svg-icons';

interface Contributor {
profileImage?: string;
Expand Down Expand Up @@ -45,6 +47,7 @@ interface FeedItemHeaderProps {
twitterMentions?: number;
newsMentions?: number;
altmetricScore?: number | null;
aiScore?: number | null;
}

export const FeedItemHeader: FC<FeedItemHeaderProps> = ({
Expand All @@ -68,6 +71,7 @@ export const FeedItemHeader: FC<FeedItemHeaderProps> = ({
twitterMentions = 0,
newsMentions = 0,
altmetricScore,
aiScore = -1,
}) => {
// Format date consistently
const formattedDate = timestamp instanceof Date ? timestamp : new Date(timestamp);
Expand Down Expand Up @@ -199,6 +203,18 @@ export const FeedItemHeader: FC<FeedItemHeaderProps> = ({
</div>
</Tooltip>
)}

{aiScore && aiScore > 0 && (
<Tooltip
content={<div className="text-sm">Probability of this comment being AI generated.</div>}
position="top"
>
<div className="flex flex-row items-center gap-1">
<FontAwesomeIcon icon={faMicrochipAi} className="font-normal" />
<p className="text-xs">{aiScore}%</p>
</div>
</Tooltip>
)}
</div>
);
};
1 change: 1 addition & 0 deletions components/Feed/items/FeedItemComment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export const FeedItemComment: FC<FeedItemCommentProps> = ({
user={author.user}
actionText={isReview ? `submitted a peer review` : 'added a comment'}
work={entry.relatedWork}
aiScore={comment.aiScore ?? -1}
/>
{showLegacyCommentBanner && (
<LegacyCommentBanner
Expand Down
2 changes: 2 additions & 0 deletions types/comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export interface Comment {
isVoteUpdate?: boolean;
[key: string]: any;
};
aiScore?: number;
}

export const transformThread: BaseTransformer<any, Thread> = (raw) => ({
Expand Down Expand Up @@ -150,6 +151,7 @@ export const transformComment = (raw: any): Comment => {
userVote,
raw,
metadata: raw.metadata,
aiScore: raw.ai_score,
};

return result;
Expand Down
2 changes: 2 additions & 0 deletions types/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export interface FeedCommentContent extends BaseFeedContent {
threadType: string;
objectId: number;
};
aiScore?: number;
};
isRemoved?: boolean;
relatedDocumentId?: number | string;
Expand Down Expand Up @@ -824,6 +825,7 @@ export const transformCommentToFeedItem = (
objectId: comment.thread.objectId,
}
: undefined,
aiScore: comment.aiScore || -1,
},
relatedDocumentId: comment.thread?.objectId,
relatedDocumentContentType: contentType,
Expand Down