Skip to content

Commit 1aaf2f4

Browse files
committed
2 parents 78d3e37 + 6e150ae commit 1aaf2f4

4 files changed

Lines changed: 19 additions & 6 deletions

File tree

packages/server/api/src/app/ai/chat/ai-mcp-chat.controller.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
import { ModelMessage, UserModelMessage } from 'ai';
2626
import { FastifyReply } from 'fastify';
2727
import { StatusCodes } from 'http-status-codes';
28+
import removeMarkdown from 'markdown-to-text';
2829
import {
2930
createChatContext,
3031
deleteChatHistory,
@@ -263,7 +264,7 @@ export const aiMCPChatController: FastifyPluginAsyncTypebox = async (app) => {
263264
}
264265

265266
const rawChatName = await generateChatName(userMessages, projectId);
266-
const chatName = rawChatName.trim() || DEFAULT_CHAT_NAME;
267+
const chatName = removeMarkdown(rawChatName).trim() || DEFAULT_CHAT_NAME;
267268

268269
await updateChatName(chatId, userId, projectId, chatName);
269270

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { AuthenticationResponse } from '@openops/shared';
2+
import { authenticationService } from './basic/authentication-service';
3+
import { SignInParams, SignUpParams } from './types';
4+
5+
export type AuthenticationService = {
6+
signUp(params: SignUpParams): Promise<AuthenticationResponse>;
7+
signIn(request: SignInParams): Promise<AuthenticationResponse>;
8+
};
9+
10+
export function getAuthenticationService(): AuthenticationService {
11+
return authenticationService;
12+
}

packages/server/api/src/app/authentication/authentication.controller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { analyticsDashboardService } from '../openops-analytics/analytics-dashbo
1616
import { resolveOrganizationIdForAuthnRequest } from '../organization/organization-utils';
1717
import { userService } from '../user/user-service';
1818
import { analyticsAuthenticationService } from './analytics-authentication-service';
19-
import { authenticationService } from './basic/authentication-service';
19+
import { getAuthenticationService } from './authentication-service-factory';
2020
import {
2121
removeAuthCookies,
2222
setAuthCookies,
@@ -100,7 +100,7 @@ const signUpRoute = async (request: any, reply: any) => {
100100
});
101101
}
102102

103-
const signUpResponse = await authenticationService.signUp({
103+
const signUpResponse = await getAuthenticationService().signUp({
104104
...request.body,
105105
verified: edition === OpsEdition.COMMUNITY,
106106
organizationId: null,
@@ -117,7 +117,7 @@ const signInRoute = async (request: any, reply: any) => {
117117
request,
118118
);
119119

120-
const signInResponse = await authenticationService.signIn({
120+
const signInResponse = await getAuthenticationService().signIn({
121121
email: request.body.email,
122122
password: request.body.password,
123123
organizationId,

packages/server/api/src/app/database/seeds/dev-seeds.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { logger, SharedSystemProp, system } from '@openops/server-shared';
22
import { EnvironmentType, Provider } from '@openops/shared';
3-
import { authenticationService } from '../../authentication/basic/authentication-service';
3+
import { getAuthenticationService } from '../../authentication/authentication-service-factory';
44
import { FlagEntity } from '../../flags/flag.entity';
55
import { databaseConnection } from '../database-connection';
66

@@ -30,7 +30,7 @@ const seedDevUser = async (): Promise<void> => {
3030
const DEV_EMAIL = 'dev@openops.com';
3131
const DEV_PASSWORD = '12345678';
3232

33-
await authenticationService.signUp({
33+
await getAuthenticationService().signUp({
3434
email: DEV_EMAIL,
3535
password: DEV_PASSWORD,
3636
firstName: 'Dev',

0 commit comments

Comments
 (0)