Skip to content

Commit 152c80c

Browse files
authored
Merge pull request #3445 from RedisInsight/latest
Latest to main
2 parents 0870f8d + e053752 commit 152c80c

File tree

51 files changed

+337
-115
lines changed

Some content is hidden

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

51 files changed

+337
-115
lines changed

.circleci/build/release-docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -e
33

44
HELP="Args:
5-
-v - Semver (2.48.0)
5+
-v - Semver (2.50.0)
66
-d - Build image repository (Ex: -d redisinsight)
77
-r - Target repository (Ex: -r redis/redisinsight)
88
"

.circleci/config.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,15 @@ executors:
187187
machine:
188188
image: ubuntu-2004:2023.04.2
189189
docker_layer_caching: true
190+
docker-node:
191+
docker:
192+
- image: cimg/node:18.15.0
193+
docker:
194+
docker:
195+
- image: cibuilds/docker:19.03.5
196+
macos:
197+
macos:
198+
xcode: 14.2.0
190199

191200
parameters:
192201
linux:
@@ -208,8 +217,7 @@ parameters:
208217
jobs:
209218
# Test jobs
210219
unit-tests-ui:
211-
docker:
212-
- image: cimg/node:18.15.0
220+
executor: docker-node
213221
steps:
214222
- checkout
215223
- restore_cache:
@@ -252,8 +260,7 @@ jobs:
252260
paths:
253261
- ./node_modules
254262
unit-tests-api:
255-
docker:
256-
- image: cimg/node:18.15.0
263+
executor: docker-node
257264
steps:
258265
- checkout
259266
- restore_cache:
@@ -522,15 +529,14 @@ jobs:
522529

523530
# Build jobs
524531
manual-build-validate:
532+
executor: docker-node
525533
parameters:
526534
os:
527535
type: string
528536
default: ""
529537
target:
530538
type: string
531539
default: ""
532-
docker:
533-
- image: cimg/node:18.15.0
534540
steps:
535541
- checkout
536542
- run:
@@ -552,14 +558,13 @@ jobs:
552558
paths:
553559
- certs
554560
setup-build:
561+
executor: docker
555562
parameters:
556563
env:
557564
description: Build environment (stage || prod)
558565
type: enum
559566
default: stage
560567
enum: [ 'dev', 'stage', 'prod' ]
561-
docker:
562-
- image: cibuilds/docker:19.03.5
563568
steps:
564569
- checkout
565570
- run:
@@ -577,8 +582,7 @@ jobs:
577582
paths:
578583
- electron
579584
linux:
580-
machine:
581-
image: ubuntu-2004:202101-01
585+
executor: linux-executor
582586
resource_class: large
583587
parameters:
584588
env:
@@ -652,8 +656,7 @@ jobs:
652656
- release/Redis-Insight*.snap
653657
- release/*-linux.yml
654658
macosx:
655-
macos:
656-
xcode: 14.2.0
659+
executor: macos
657660
resource_class: macos.x86.medium.gen2
658661
parameters:
659662
env:

redisinsight/api/config/default.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default {
7676
tlsKey: process.env.RI_SERVER_TLS_KEY,
7777
staticContent: !!process.env.RI_SERVE_STATICS || true,
7878
buildType: process.env.RI_BUILD_TYPE || 'DOCKER_ON_PREMISE',
79-
appVersion: process.env.RI_APP_VERSION || '2.48.0',
79+
appVersion: process.env.RI_APP_VERSION || '2.50.0',
8080
requestTimeout: parseInt(process.env.RI_REQUEST_TIMEOUT, 10) || 25000,
8181
excludeRoutes: [],
8282
excludeAuthRoutes: [],

redisinsight/api/config/production.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default {
2323
join(os.homedir(), '.redisinsight-preview'),
2424
join(os.homedir(), '.redisinsight-v2'),
2525
process.env.RI_GUIDES_PATH || join(homedir, 'guides'),
26-
]
26+
],
2727
},
2828
server: {
2929
env: 'production',
@@ -40,5 +40,7 @@ export default {
4040
},
4141
ai: {
4242
convAiApiUrl: process.env.RI_AI_CONVAI_API_URL || 'https://redis.io/convai/api',
43+
querySocketUrl: process.env.RI_AI_QUERY_SOCKET_URL || 'https://app.redislabs.com',
44+
querySocketPath: process.env.RI_AI_QUERY_SOCKET_PATH || '/api/v1/cloud-copilot-service/socket.io/',
4345
},
4446
};

redisinsight/api/config/swagger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const SWAGGER_CONFIG: Omit<OpenAPIObject, 'paths'> = {
55
info: {
66
title: 'Redis Insight Backend API',
77
description: 'Redis Insight Backend API',
8-
version: '2.48.0',
8+
version: '2.50.0',
99
},
1010
tags: [],
1111
};

redisinsight/api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "redisinsight-api",
3-
"version": "2.48.0",
3+
"version": "2.50.0",
44
"description": "Redis Insight API",
55
"private": true,
66
"author": {

redisinsight/api/src/modules/ai/query/ai-query.service.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import { isArray } from 'lodash';
12
import { Socket } from 'socket.io-client';
23
import { Injectable, Logger } from '@nestjs/common';
34
import { ClientContext, SessionMetadata } from 'src/common/models';
45
import { AiQueryProvider } from 'src/modules/ai/query/providers/ai-query.provider';
56
import { SendAiQueryMessageDto } from 'src/modules/ai/query/dto/send.ai-query.message.dto';
67
import { wrapAiQueryError } from 'src/modules/ai/query/exceptions';
78
import { DatabaseClientFactory } from 'src/modules/database/providers/database.client.factory';
8-
import { getFullDbContext, getIndexContext } from 'src/modules/ai/query/utils/context.util';
9+
import { getFullDbContext, getIndexContext, quotesIfNeeded } from 'src/modules/ai/query/utils/context.util';
910
import { Response } from 'express';
1011
import {
1112
AiQueryMessage,
@@ -56,6 +57,24 @@ export class AiQueryService {
5657
return steps;
5758
}
5859

60+
static prepareToolReply(toolReply: any) {
61+
try {
62+
const prepared = JSON.parse(toolReply);
63+
64+
if (prepared?.name === 'query' && prepared.content) {
65+
const query = JSON.parse(prepared.content);
66+
if (isArray(query)) {
67+
prepared.content.query = JSON.stringify(query.map(quotesIfNeeded));
68+
}
69+
return JSON.stringify(prepared);
70+
}
71+
} catch (e) {
72+
// ignore error
73+
}
74+
75+
return toolReply;
76+
}
77+
5978
static prepareHistory(messages: AiQueryMessage[]): string[][] {
6079
const history = [];
6180
messages.forEach((message) => {
@@ -178,7 +197,7 @@ export class AiQueryService {
178197
socket.on(AiQueryWsEvents.TOOL_REPLY, async (data) => {
179198
answer.steps.push(plainToClass(AiQueryIntermediateStep, {
180199
type: AiQueryIntermediateStepType.TOOL,
181-
data,
200+
data: AiQueryService.prepareToolReply(data),
182201
}));
183202
});
184203

redisinsight/api/src/modules/ai/query/utils/context.util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type RedisClient = { sendCommand: (args: any, options: any) => Promise<any> };
99
const DOCUMENT_SAMPLES_PER_PREFIX = 5;
1010
const HSCAN_COUNT = 500;
1111

12-
const quotesIfNeeded = (str: string) => (str.indexOf(' ') > -1 ? JSON.stringify(str) : str);
12+
export const quotesIfNeeded = (str: string) => (str.indexOf(' ') > -1 ? JSON.stringify(str) : str);
1313

1414
// ====================================================================
1515
// Reply converter
@@ -77,7 +77,7 @@ export const getAttributeTopValues = async (client: RedisClient, index: string,
7777

7878
return {
7979
distinct_count: parseInt(distinct, 10),
80-
top_values: top?.map(([, value, , count]) => ({ value, count })),
80+
top_values: top?.map(([, value]) => ({ value })),
8181
};
8282
default:
8383
return {};

redisinsight/api/src/modules/cloud/common/models/cloud-request-utm.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,12 @@ export class CloudRequestUtm {
3737
@IsString()
3838
@IsNotEmpty()
3939
amp?: string;
40+
41+
@ApiPropertyOptional({
42+
type: String,
43+
})
44+
@IsOptional()
45+
@IsString()
46+
@IsNotEmpty()
47+
package?: string;
4048
}

redisinsight/api/src/modules/cloud/common/providers/cloud.api.provider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export class CloudApiProvider {
4141
utm_medium: utm?.medium,
4242
utm_campaign: utm?.campaign,
4343
utm_amp: utm?.amp,
44+
utm_package: utm?.package,
4445
};
4546
}
4647

0 commit comments

Comments
 (0)