Skip to content

Commit ea13a41

Browse files
OrriMandarinChibiBlasphem
authored andcommitted
feat: add endpoint for AST description pass through request body
1 parent 8e26f49 commit ea13a41

3 files changed

Lines changed: 48 additions & 4 deletions

File tree

packages/marble-api/openapis/marblecore-api.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ paths:
219219

220220
/scenario-iteration-rules:
221221
$ref: ./marblecore-api/scenario-iteration-rules.yml#/~1scenario-iteration-rules
222+
/scenario-iteration-rules/ai-description:
223+
$ref: ./marblecore-api/scenario-iteration-rules.yml#/~1scenario-iteration-rules~1ai-description
222224
/scenario-iteration-rules/{ruleId}:
223225
$ref: ./marblecore-api/scenario-iteration-rules.yml#/~1scenario-iteration-rules~1{ruleId}
224226
/scenario-iteration-rules/{ruleId}/ai-description:

packages/marble-api/openapis/marblecore-api/scenario-iteration-rules.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,33 @@
6363
$ref: 'components.yml#/responses/403'
6464
'404':
6565
$ref: 'components.yml#/responses/404'
66+
/scenario-iteration-rules/ai-description:
67+
post:
68+
tags:
69+
- Scenario Iteration Rules
70+
summary: Generate AI description for an AST expression
71+
operationId: GenerateAiDescriptionForAstExpression
72+
security:
73+
- bearerAuth: []
74+
requestBody:
75+
description: 'AST expression to generate AI description for'
76+
required: true
77+
content:
78+
application/json:
79+
schema:
80+
type: object
81+
required:
82+
ast_expression
83+
properties:
84+
ast_expression:
85+
$ref: 'ast.yml#/components/schemas/NodeDto'
86+
responses:
87+
'200':
88+
description: The created scenario iteration rule AI description
89+
content:
90+
application/json:
91+
schema:
92+
$ref: '#/components/schemas/ScenarioIterationRuleAiDescriptionDto'
6693
/scenario-iteration-rules/{ruleId}:
6794
get:
6895
tags:

packages/marble-api/src/generated/marblecore-api.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,10 @@ export type OpenSanctionsDatasetFreshnessDto = {
952952
version: string;
953953
up_to_date: boolean;
954954
};
955+
export type ScenarioIterationRuleAiDescriptionDto = {
956+
/** The AI description for the scenario iteration rule */
957+
description: string;
958+
};
955959
export type UpdateScenarioIterationRuleBodyDto = {
956960
display_order?: number;
957961
name?: string;
@@ -960,10 +964,6 @@ export type UpdateScenarioIterationRuleBodyDto = {
960964
formula_ast_expression?: (NodeDto) | null;
961965
score_modifier?: number;
962966
};
963-
export type ScenarioIterationRuleAiDescriptionDto = {
964-
/** The AI description for the scenario iteration rule */
965-
description: string;
966-
};
967967
export type PublicationAction = "publish" | "unpublish";
968968
export type ScenarioPublication = {
969969
id: string;
@@ -3232,6 +3232,21 @@ export function createScenarioIterationRule(createScenarioIterationRuleBodyDto:
32323232
body: createScenarioIterationRuleBodyDto
32333233
})));
32343234
}
3235+
/**
3236+
* Generate AI description for an AST expression
3237+
*/
3238+
export function generateAiDescriptionForAstExpression(body: {
3239+
ast_expression: NodeDto;
3240+
}, opts?: Oazapfts.RequestOpts) {
3241+
return oazapfts.ok(oazapfts.fetchJson<{
3242+
status: 200;
3243+
data: ScenarioIterationRuleAiDescriptionDto;
3244+
}>("/scenario-iteration-rules/ai-description", oazapfts.json({
3245+
...opts,
3246+
method: "POST",
3247+
body
3248+
})));
3249+
}
32353250
/**
32363251
* Get a scenario iteration rule by id
32373252
*/

0 commit comments

Comments
 (0)