Skip to content

feat(cypherGenerator): cypher generator with gpt model #765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: develop-maintenance
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/api/GraphQuery/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import {LkErrorKey} from '../../http/response';

import {
CheckQueryResponse,
CypherGeneratorResponse,
GraphQuery,
ICheckQueryParams,
ICreateQueryParams,
ICypherGeneratorParams,
IDeleteQueryParams,
IGetQueriesParams,
IGetQueryParams,
Expand Down Expand Up @@ -176,4 +178,17 @@ export class GraphQueryAPI extends Request {
params: params
});
}

/**
* Get all the nodes and edges matching the given saved graph query by id.
* A subgraph made of all the nodes and the edges from each subgraph matching the graph query is returned.
*/
public aiCypher(this: Request<CypherGeneratorResponse>, params: ICypherGeneratorParams) {
return this.request({
errors: [UNAUTHORIZED],
url: '/:sourceKey/cypher',
method: 'POST',
params: params
});
}
}
9 changes: 9 additions & 0 deletions src/api/GraphQuery/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,12 @@ export interface ErrorHighlight {
offset: number;
length?: number;
}

export interface ICypherGeneratorParams extends IDataSourceParams {
question: string;
}

export interface CypherGeneratorResponse {
cypherQuery: string;
isOk: boolean;
}
32 changes: 31 additions & 1 deletion src/api/Visualization/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ import {
VisualizationComment,
CreateVisualizationCommentParams,
GetVisualizationCommentsParams,
DeleteVisualizationCommentParams
DeleteVisualizationCommentParams,
IStylesGeneratorParams,
StylesGeneratorResponse
} from './types';

export * from './types';
Expand Down Expand Up @@ -388,6 +390,21 @@ export class VisualizationAPI extends Request {
});
}

/**
* Create a visualization ai answer comment.
*/
createVisualizationAiAnswerComment(
this: Request<VisualizationComment>,
params: CreateVisualizationCommentParams
) {
return this.request({
errors: [UNAUTHORIZED, DATA_SOURCE_UNAVAILABLE, NOT_FOUND],
url: '/:sourceKey/visualizations/:visualizationId/commentsAi',
method: 'POST',
params: params
});
}

/**
* Get the visualization comment(s).
*/
Expand All @@ -414,4 +431,17 @@ export class VisualizationAPI extends Request {
params: params
});
}

/**
* Get all the nodes and edges matching the given saved graph query by id.
* A subgraph made of all the nodes and the edges from each subgraph matching the graph query is returned.
*/
public aiStyles(this: Request<StylesGeneratorResponse>, params: IStylesGeneratorParams) {
return this.request({
errors: [UNAUTHORIZED],
url: '/:sourceKey/ai/styles',
method: 'POST',
params: params
});
}
}
20 changes: 19 additions & 1 deletion src/api/Visualization/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,16 @@ import {
IVizNodeGroupInfo
} from '../graphItemTypes';
import {GraphQueryDialect} from '../GraphQuery';
import {IRangeValues, ItemSelector, IStyles, IStyleIcon, IStyleImage} from '../displayTypes';
import {
IRangeValues,
ItemSelector,
IStyles,
IStyleIcon,
IStyleImage,
INodeStyle,
IEdgeStyle,
IStyleRule
} from '../displayTypes';
import {User} from '../User';
import {IAlternativeIdSettings} from '../DataSource';
import {ILeafletConfig} from '../Config';
Expand Down Expand Up @@ -456,3 +465,12 @@ export interface GetVisualizationCommentsParams extends IDataSourceParams, Pagin
export interface DeleteVisualizationCommentParams extends IDataSourceParams {
commentId: number;
}

export interface IStylesGeneratorParams extends IDataSourceParams {
question: string;
}

export interface StylesGeneratorResponse {
styles: IStyleRule<INodeStyle | IEdgeStyle>;
isOk: boolean;
}