Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevo David committed Oct 29, 2024
2 parents c014061 + b09cd71 commit c3e7377
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
7 changes: 6 additions & 1 deletion apps/backend/src/api/routes/copilot.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Controller, Get, Post, Req, Res } from '@nestjs/common';
import { Logger, Controller, Get, Post, Req, Res } from '@nestjs/common';
import {
CopilotRuntime,
OpenAIAdapter,
Expand All @@ -13,6 +13,11 @@ export class CopilotController {
constructor(private _subscriptionService: SubscriptionService) {}
@Post('/chat')
chat(@Req() req: Request, @Res() res: Response) {
if (process.env.OPENAI_API_KEY === undefined || process.env.OPENAI_API_KEY === '') {
Logger.warn('OpenAI API key not set, chat functionality will not work');
return
}

const copilotRuntimeHandler = copilotRuntimeNestEndpoint({
endpoint: '/copilot/chat',
runtime: new CopilotRuntime(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export default withProvider(null, undefined, undefined, async (posts) => {
}

return true;
});
}, 300);
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ export default withProvider(
undefined,
DiscordDto,
undefined,
280
1980
);
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '@gitroom/nestjs-libraries/integrations/social/social.integrations.interface';
import { makeId } from '@gitroom/nestjs-libraries/services/make.is';
import { SocialAbstract } from '@gitroom/nestjs-libraries/integrations/social.abstract';
import { BskyAgent } from '@atproto/api';
import { BskyAgent, RichText } from '@atproto/api';
import dayjs from 'dayjs';
import { Integration } from '@prisma/client';
import { AuthService } from '@gitroom/helpers/auth/auth.service';
Expand Down Expand Up @@ -132,9 +132,16 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
}) || []
);

const rt = new RichText({
text: post.message,
})

await rt.detectFacets(agent)

// @ts-ignore
const { cid, uri, commit } = await agent.post({
text: post.message,
text: rt.text,
facets: rt.facets,
createdAt: new Date().toISOString(),
...(images.length
? {
Expand Down

0 comments on commit c3e7377

Please sign in to comment.