@praxisui/ai 8.0.0-beta.34 → 8.0.0-beta.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/praxisui-ai.mjs +37 -6
- package/package.json +2 -2
- package/types/praxisui-ai.d.ts +3 -0
package/fesm2022/praxisui-ai.mjs
CHANGED
|
@@ -1988,6 +1988,7 @@ class PraxisAssistantTurnController {
|
|
|
1988
1988
|
options;
|
|
1989
1989
|
stateSubject;
|
|
1990
1990
|
state$;
|
|
1991
|
+
activeFlowClientTurnId = null;
|
|
1991
1992
|
constructor(flow, options) {
|
|
1992
1993
|
this.flow = flow;
|
|
1993
1994
|
this.options = options;
|
|
@@ -2080,19 +2081,17 @@ class PraxisAssistantTurnController {
|
|
|
2080
2081
|
: '';
|
|
2081
2082
|
const userMessage = this.buildMessage('user', displayPrompt || normalized, true);
|
|
2082
2083
|
this.patchState({
|
|
2084
|
+
...this.resetActiveTurnState(),
|
|
2083
2085
|
state: 'processing',
|
|
2084
2086
|
phase: 'contextualize',
|
|
2085
2087
|
clientTurnId,
|
|
2086
|
-
errorText: '',
|
|
2087
|
-
statusText: '',
|
|
2088
|
-
quickReplies: [],
|
|
2089
|
-
clarificationQuestions: [],
|
|
2090
2088
|
messages: [...current.messages, userMessage],
|
|
2091
2089
|
});
|
|
2092
2090
|
return this.runFlow('submit', {
|
|
2093
2091
|
prompt: normalized,
|
|
2094
2092
|
action: effectiveAction,
|
|
2095
2093
|
phase: 'contextualize',
|
|
2094
|
+
pendingClarification: current.pendingClarification,
|
|
2096
2095
|
});
|
|
2097
2096
|
}
|
|
2098
2097
|
answerClarification(option) {
|
|
@@ -2174,6 +2173,8 @@ class PraxisAssistantTurnController {
|
|
|
2174
2173
|
}
|
|
2175
2174
|
runFlow(method, partial) {
|
|
2176
2175
|
const request = this.buildRequest(partial);
|
|
2176
|
+
const requestClientTurnId = request.clientTurnId ?? null;
|
|
2177
|
+
this.activeFlowClientTurnId = requestClientTurnId;
|
|
2177
2178
|
const handler = this.flow[method];
|
|
2178
2179
|
if (!handler) {
|
|
2179
2180
|
return of(this.snapshot());
|
|
@@ -2183,16 +2184,23 @@ class PraxisAssistantTurnController {
|
|
|
2183
2184
|
flowResult = handler.call(this.flow, request);
|
|
2184
2185
|
}
|
|
2185
2186
|
catch (error) {
|
|
2186
|
-
|
|
2187
|
+
if (this.shouldApplyFlowResult(requestClientTurnId)) {
|
|
2188
|
+
this.applyResult(this.buildFlowErrorResult(error));
|
|
2189
|
+
}
|
|
2187
2190
|
return of(this.snapshot());
|
|
2188
2191
|
}
|
|
2189
2192
|
return this.toObservable(flowResult).pipe(tap((result) => {
|
|
2193
|
+
if (!this.shouldApplyFlowResult(requestClientTurnId, result)) {
|
|
2194
|
+
return;
|
|
2195
|
+
}
|
|
2190
2196
|
this.applyResult(result);
|
|
2191
2197
|
if (method === 'cancel') {
|
|
2192
2198
|
this.resetConversationAfterCancel(result);
|
|
2193
2199
|
}
|
|
2194
2200
|
}), map$1(() => this.snapshot()), catchError$1((error) => {
|
|
2195
|
-
|
|
2201
|
+
if (this.shouldApplyFlowResult(requestClientTurnId)) {
|
|
2202
|
+
this.applyResult(this.buildFlowErrorResult(error));
|
|
2203
|
+
}
|
|
2196
2204
|
return of(this.snapshot());
|
|
2197
2205
|
}));
|
|
2198
2206
|
}
|
|
@@ -2268,6 +2276,29 @@ class PraxisAssistantTurnController {
|
|
|
2268
2276
|
observationId: null,
|
|
2269
2277
|
};
|
|
2270
2278
|
}
|
|
2279
|
+
resetActiveTurnState() {
|
|
2280
|
+
return {
|
|
2281
|
+
quickReplies: [],
|
|
2282
|
+
clarificationQuestions: [],
|
|
2283
|
+
canApply: false,
|
|
2284
|
+
statusText: '',
|
|
2285
|
+
errorText: '',
|
|
2286
|
+
preview: null,
|
|
2287
|
+
pendingPatch: null,
|
|
2288
|
+
pendingClarification: undefined,
|
|
2289
|
+
observationId: null,
|
|
2290
|
+
};
|
|
2291
|
+
}
|
|
2292
|
+
shouldApplyFlowResult(requestClientTurnId, result) {
|
|
2293
|
+
if (!requestClientTurnId) {
|
|
2294
|
+
return true;
|
|
2295
|
+
}
|
|
2296
|
+
if (result?.clientTurnId && result.clientTurnId !== requestClientTurnId) {
|
|
2297
|
+
return false;
|
|
2298
|
+
}
|
|
2299
|
+
return this.activeFlowClientTurnId === requestClientTurnId
|
|
2300
|
+
&& this.stateSubject.value.clientTurnId === requestClientTurnId;
|
|
2301
|
+
}
|
|
2271
2302
|
resetConversationState() {
|
|
2272
2303
|
return {
|
|
2273
2304
|
sessionId: this.createId('session'),
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@praxisui/ai",
|
|
3
|
-
"version": "8.0.0-beta.
|
|
3
|
+
"version": "8.0.0-beta.36",
|
|
4
4
|
"description": "AI building blocks and assistant integration for Praxis UI applications.",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@angular/common": "^21.0.0",
|
|
7
7
|
"@angular/core": "^21.0.0",
|
|
8
|
-
"@praxisui/core": "^8.0.0-beta.
|
|
8
|
+
"@praxisui/core": "^8.0.0-beta.36",
|
|
9
9
|
"@angular/cdk": "^21.0.0",
|
|
10
10
|
"@angular/forms": "^21.0.0",
|
|
11
11
|
"@angular/material": "^21.0.0",
|
package/types/praxisui-ai.d.ts
CHANGED
|
@@ -1603,6 +1603,7 @@ declare class PraxisAssistantTurnController {
|
|
|
1603
1603
|
private readonly options;
|
|
1604
1604
|
private readonly stateSubject;
|
|
1605
1605
|
readonly state$: Observable<PraxisAssistantTurnViewState>;
|
|
1606
|
+
private activeFlowClientTurnId;
|
|
1606
1607
|
constructor(flow: PraxisAssistantTurnFlow, options: PraxisAssistantTurnControllerOptions);
|
|
1607
1608
|
snapshot(): PraxisAssistantTurnViewState;
|
|
1608
1609
|
setContextItems(items: readonly PraxisAssistantShellContextItem[]): void;
|
|
@@ -1624,6 +1625,8 @@ declare class PraxisAssistantTurnController {
|
|
|
1624
1625
|
private submitExistingUserMessage;
|
|
1625
1626
|
private findUserMessageIndex;
|
|
1626
1627
|
private resetReplayState;
|
|
1628
|
+
private resetActiveTurnState;
|
|
1629
|
+
private shouldApplyFlowResult;
|
|
1627
1630
|
private resetConversationState;
|
|
1628
1631
|
private resetConversationAfterCancel;
|
|
1629
1632
|
private applyResult;
|