Skip to content

Commit d50d7eb

Browse files
Security: bump 15 patch-level dependencies to match 26_1
1 parent 9a5cbf3 commit d50d7eb

166 files changed

Lines changed: 9002 additions & 7883 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/demos/Demos/Autocomplete/Overview/Angular/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class AppComponent {
5858
this.clientsStore = new CustomStore({
5959
key: 'Value',
6060
useDefaultSearch: true,
61-
async load(loadOptions) {
61+
load(loadOptions) {
6262
let params: HttpParams = new HttpParams();
6363
[
6464
'skip',

apps/demos/Demos/Chat/AIAndChatbotIntegration/Angular/app/app.service.ts

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
11
import { Injectable } from '@angular/core';
22
import { Observable, BehaviorSubject } from 'rxjs';
3-
import { AzureOpenAI } from 'openai';
43
import { unified } from 'unified';
54
import remarkParse from 'remark-parse';
65
import remarkRehype from 'remark-rehype';
76
import rehypeStringify from 'rehype-stringify';
87
import rehypeMinifyWhitespace from 'rehype-minify-whitespace';
98
import { type DxChatTypes } from 'devextreme-angular/ui/chat';
109
import { DataSource, CustomStore } from 'devextreme-angular/common/data';
10+
import { AiService, type AIMessage } from './ai/ai.service';
1111

1212
@Injectable({
1313
providedIn: 'root',
1414
})
1515

1616
export class AppService {
17-
chatService: AzureOpenAI;
18-
19-
AzureOpenAIConfig = {
20-
dangerouslyAllowBrowser: true,
21-
deployment: 'gpt-4o-mini',
22-
apiVersion: '2024-02-01',
23-
endpoint: 'https://public-api.devexpress.com/demo-openai',
24-
apiKey: 'DEMO',
25-
};
17+
aiService: AiService;
2618

2719
REGENERATION_TEXT = 'Regeneration...';
2820

@@ -39,7 +31,7 @@ export class AppService {
3931

4032
store: any[] = [];
4133

42-
messages: any[] = [];
34+
messages: AIMessage[] = [];
4335

4436
alerts: DxChatTypes.Alert[] = [];
4537

@@ -51,8 +43,8 @@ export class AppService {
5143

5244
alertsSubject: BehaviorSubject<DxChatTypes.Alert[]> = new BehaviorSubject([]);
5345

54-
constructor() {
55-
this.chatService = new AzureOpenAI(this.AzureOpenAIConfig);
46+
constructor(aiService: AiService) {
47+
this.aiService = aiService;
5648
this.initDataSource();
5749
this.typingUsersSubject.next([]);
5850
this.alertsSubject.next([]);
@@ -98,21 +90,11 @@ export class AppService {
9890
});
9991
}
10092

101-
async getAIResponse(messages) {
102-
const params = {
103-
messages,
104-
model: this.AzureOpenAIConfig.deployment,
105-
max_tokens: 1000,
106-
temperature: 0.7,
107-
};
108-
109-
const response = await this.chatService.chat.completions.create(params);
110-
const data = { choices: response.choices };
111-
112-
return data.choices[0].message?.content;
93+
getAIResponse(messages: AIMessage[]): Promise<string> {
94+
return this.aiService.getAIResponse(messages) as Promise<string>;
11395
}
11496

115-
async processMessageSending(message) {
97+
async processMessageSending(message: DxChatTypes.Message) {
11698
this.messages.push({ role: 'user', content: message.text });
11799
this.typingUsersSubject.next([this.assistant]);
118100

apps/demos/Demos/Chat/FileAttachments/Angular/app/app.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ export class AppService {
8080
initDataSource() {
8181
this.customStore = new CustomStore({
8282
key: 'id',
83-
load: async () => this.messages,
84-
insert: async (message) => {
83+
load: () => this.messages,
84+
insert: (message) => {
8585
this.messages.push(message);
8686
return message;
8787
},

apps/demos/Demos/Chat/FileAttachments/React/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ const store: ChatTypes.Message[] = [...initialMessages];
1111

1212
const customStore = new CustomStore({
1313
key: 'id',
14-
load: async () => store,
15-
insert: async (message: ChatTypes.Message) => {
14+
load: () => Promise.resolve(store),
15+
insert: (message: ChatTypes.Message) => {
1616
store.push(message);
17-
return message;
17+
return Promise.resolve(message);
1818
},
1919
});
2020

apps/demos/Demos/Chat/FileAttachments/ReactJs/App.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import { currentUser, messages as initialMessages } from './data.js';
77
const store = [...initialMessages];
88
const customStore = new CustomStore({
99
key: 'id',
10-
load: async () => store,
11-
insert: async (message) => {
10+
load: () => Promise.resolve(store),
11+
insert: (message) => {
1212
store.push(message);
13-
return message;
13+
return Promise.resolve(message);
1414
},
1515
});
1616
const dataSource = new DataSource({

apps/demos/Demos/Chat/MessageEditing/Angular/app/app.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ export class AppService {
7272
initDataSource() {
7373
this.customStore = new CustomStore({
7474
key: 'id',
75-
load: async () => this.messages,
76-
insert: async (message) => {
75+
load: () => this.messages,
76+
insert: (message) => {
7777
this.messages.push(message);
7878
return message;
7979
},

apps/demos/Demos/Chat/MessageEditing/React/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ const store: ChatTypes.Message[] = [...initialMessages];
3333

3434
const customStore = new CustomStore({
3535
key: 'id',
36-
load: async (): Promise<ChatTypes.Message[]> => store,
37-
insert: async (message: ChatTypes.Message): Promise<ChatTypes.Message> => {
36+
load: (): Promise<ChatTypes.Message[]> => Promise.resolve(store),
37+
insert: (message: ChatTypes.Message): Promise<ChatTypes.Message> => {
3838
store.push(message);
39-
return message;
39+
return Promise.resolve(message);
4040
},
4141
});
4242

apps/demos/Demos/Chat/MessageEditing/ReactJs/App.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ const editingStrategy = {
2626
const store = [...initialMessages];
2727
const customStore = new CustomStore({
2828
key: 'id',
29-
load: async () => store,
30-
insert: async (message) => {
29+
load: () => Promise.resolve(store),
30+
insert: (message) => {
3131
store.push(message);
32-
return message;
32+
return Promise.resolve(message);
3333
},
3434
});
3535
const dataSource = new DataSource({

apps/demos/Demos/DataGrid/AIColumns/Angular/app/ai/ai.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async function getAIResponse(messages: AIMessage[], signal: AbortSignal) {
4242
return result;
4343
}
4444

45-
async function getAIResponseRecursive(messages: AIMessage[], signal: AbortSignal): Promise<string> {
45+
function getAIResponseRecursive(messages: AIMessage[], signal: AbortSignal): Promise<string> {
4646
return getAIResponse(messages, signal)
4747
.catch(async (error) => {
4848
if (!error.message.includes('Connection error')) {

apps/demos/Demos/DataGrid/AIColumns/React/service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ async function getAIResponse(messages: AIMessage[], signal: AbortSignal) {
2828
return result ?? '';
2929
}
3030

31-
async function getAIResponseRecursive(messages: AIMessage[], signal: AbortSignal): Promise<string> {
31+
function getAIResponseRecursive(messages: AIMessage[], signal: AbortSignal): Promise<string> {
3232
return getAIResponse(messages, signal)
3333
.catch(async (error) => {
3434
if (!error.message.includes('Connection error')) {

0 commit comments

Comments
 (0)