Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
c3e73779b7
|
|
@ -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,
|
||||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -6,4 +6,4 @@ export default withProvider(null, undefined, undefined, async (posts) => {
|
|||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}, 300);
|
||||
|
|
|
|||
|
|
@ -17,5 +17,5 @@ export default withProvider(
|
|||
undefined,
|
||||
DiscordDto,
|
||||
undefined,
|
||||
280
|
||||
1980
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
@ -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
|
||||
? {
|
||||
|
|
|
|||
Loading…
Reference in New Issue