Skip to content

Commit a6f0cbe

Browse files
v0.4.0
1 parent baae6a1 commit a6f0cbe

File tree

9 files changed

+34
-31
lines changed

9 files changed

+34
-31
lines changed

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "quickblox-react-ui-kit",
3-
"version": "0.4.0-beta.1",
3+
"version": "0.4.0",
44
"main": "dist/index-ui.js",
55
"license": "MIT",
66
"dependencies": {
@@ -12,7 +12,7 @@
1212
"qb-ai-core": "^0.1.3",
1313
"qb-ai-rephrase": "^0.1.2",
1414
"qb-ai-translate": "^0.1.2",
15-
"quickblox": "^2.17.0-beta.1",
15+
"quickblox": "^2.17.0",
1616
"react": "^18.2.0",
1717
"react-dom": "^18.2.0",
1818
"react-router-dom": "^6.11.1",

src/Data/DefaultConfigurations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export class DefaultConfigurations {
181181
organizationName: 'Quickblox',
182182
openAIModel: 'gpt-3.5-turbo',
183183
smartChatAssistantId: '',
184-
apiKey: '6633a1300fea600001bd6e71',
184+
apiKey: '',
185185
maxTokens: 3584,
186186
useDefault: true,
187187
defaultTone: 'Professional',

src/Data/source/remote/IRemoteDataSource.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import { ChatMessage } from 'qb-ai-core';
2-
import { AIAnswerAssistantSettings } from 'qb-ai-answer-assistant';
3-
import { AITranslateSettings } from 'qb-ai-translate';
4-
import {AIChatHistory, AIChatMessage} from 'quickblox';
1+
import { AIChatHistory, AIAnswerResponse } from 'quickblox';
52
import { RemoteDialogDTO } from '../../dto/dialog/RemoteDialogDTO';
63
import { RemoteDialogsDTO } from '../../dto/dialog/RemoteDialogsDTO';
74
import { RemoteUserDTO } from '../../dto/user/RemoteUserDTO';
@@ -12,7 +9,6 @@ import { RemoteFileDTO } from '../../dto/file/RemoteFileDTO';
129
import { Pagination } from '../../../Domain/repository/Pagination';
1310
import { CallBackFunction } from '../../../Domain/use_cases/base/IUseCase';
1411
import { NotificationTypes } from '../../../Domain/entity/NotificationTypes';
15-
import {AIAnswerResponse} from "../../../qb-api-calls";
1612
// todo list of all actions - for what we need to create tests
1713
/*
1814
0!!! не реализованы эксепшены для createDialog RemouteDataSource и

src/Data/source/remote/RemoteDataSource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import QB, {
1515
QBUser,
1616
QBMessageStatusParams,
1717
AIChatHistory,
18+
AIAnswerResponse,
1819
} from 'quickblox/quickblox';
1920
import { RemoteDialogDTO } from '../../dto/dialog/RemoteDialogDTO';
2021
import {
@@ -35,7 +36,6 @@ import { DialogDTOMapper } from './Mapper/DialogDTOMapper';
3536
import { IDTOMapper } from './Mapper/IDTOMapper';
3637
import { Stubs } from '../../Stubs';
3738
import {
38-
AIAnswerResponse,
3939
QBAnswerAssist,
4040
QBChatConnect,
4141
QBChatDisconnect,

src/Domain/use_cases/ai/AIAnswerAssistWithSDKUseCase.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
// eslint-disable-next-line import/extensions
2-
import { AIChatMessage, AIRole } from 'quickblox';
2+
import { AIAnswerResponse, AIChatMessage, AIRole } from 'quickblox';
33
import { IChatMessage } from '../../../Data/source/AISource';
44
import { IUseCase } from '../base/IUseCase';
55
import { IRemoteDataSource } from '../../../Data/source/remote/IRemoteDataSource';
6-
import { AIAnswerResponse } from '../../../qb-api-calls';
76

8-
interface AIChatMessageEx extends AIChatMessage {
9-
content: string;
10-
}
7+
// interface AIChatMessageEx extends AIChatMessage {
8+
// content: string;
9+
// } // artik 19.05.2024
1110
export class AIAnswerAssistWithSDKUseCase implements IUseCase<void, string> {
1211
private textToSend: string;
1312

@@ -32,13 +31,12 @@ export class AIAnswerAssistWithSDKUseCase implements IUseCase<void, string> {
3231

3332
async execute(): Promise<string> {
3433
console.log('execute AIAnswerAssistWithSDKUseCase');
35-
const history: AIChatMessageEx[] = this.dialogMessages.map(
34+
const history: AIChatMessage[] = this.dialogMessages.map(
3635
(msg: IChatMessage) => {
3736
return {
3837
role: msg.role as AIRole,
3938
message: msg.content,
40-
content: msg.content,
41-
} as AIChatMessageEx;
39+
} as AIChatMessage;
4240
},
4341
);
4442
const response: AIAnswerResponse = await this.dataSource.createAnswer(

src/Domain/use_cases/ai/AITranslateWithSDKUseCase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// eslint-disable-next-line import/extensions
2+
import { AIAnswerResponse } from 'quickblox/quickblox';
23
import { IUseCase } from '../base/IUseCase';
34
import { IRemoteDataSource } from '../../../Data/source/remote/IRemoteDataSource';
4-
import { AIAnswerResponse } from '../../../qb-api-calls';
55

66
export class AITranslateWithSDKUseCase implements IUseCase<void, string> {
77
private languageCodes: { [key: string]: string } = {

src/Presentation/Views/Dialog/AIWidgets/UseDefaultAIAssistAnswerWidgetWithSDK.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,19 @@ export default function UseDefaultAIAssistAnswerWidgetWithSDK(
4848
);
4949

5050
// eslint-disable-next-line no-return-await
51-
return await useCaseAIAnswerAssist.execute().then((data) => {
52-
setTextFromWidgetToContent(data);
51+
return await useCaseAIAnswerAssist
52+
.execute()
53+
.then((data) => {
54+
setTextFromWidgetToContent(data);
5355

54-
return data;
55-
});
56+
return data;
57+
})
58+
.catch((reason) => {
59+
console.log('SDK: ai answer assist error: ', reason);
60+
setTextFromWidgetToContent(JSON.stringify(reason));
61+
62+
return reason;
63+
});
5664
}
5765

5866
return '';

src/qb-api-calls/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import QB, {
2+
AIAnswerResponse,
23
AIChatHistory,
34
ChatConnectParams,
45
GetMessagesResult,
@@ -620,9 +621,9 @@ export function QBWebRTCSessionGetUserMedia(
620621
});
621622
});
622623
}
623-
export interface AIAnswerResponse {
624-
answer: string;
625-
}
624+
// export interface AIAnswerResponse {
625+
// answer: string;
626+
// } // artim 19.05.2024
626627

627628
export function QBAnswerAssist(
628629
smartChatAssistantId: string,

0 commit comments

Comments
 (0)