@copilotz/chat-adapter 0.9.45 → 0.9.46
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/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -111,6 +111,9 @@ var getStreamEventPayload = (event) => {
|
|
|
111
111
|
var getLlmAttemptId = (event) => {
|
|
112
112
|
if (!isRecord(event)) return null;
|
|
113
113
|
const metadata = isRecord(event.metadata) ? event.metadata : {};
|
|
114
|
+
if (typeof metadata.streamLlmAttemptId === "string" && metadata.streamLlmAttemptId.trim().length > 0) {
|
|
115
|
+
return metadata.streamLlmAttemptId.trim();
|
|
116
|
+
}
|
|
114
117
|
if (typeof metadata.llmAttemptId === "string" && metadata.llmAttemptId.trim().length > 0) {
|
|
115
118
|
return metadata.llmAttemptId.trim();
|
|
116
119
|
}
|
|
@@ -1881,13 +1884,14 @@ var transitionLiveRun = (state, action, options) => {
|
|
|
1881
1884
|
};
|
|
1882
1885
|
}
|
|
1883
1886
|
if (action.type === "attempt-result") {
|
|
1884
|
-
const
|
|
1887
|
+
const resolvedAttemptId = state.attemptsById.has(action.attemptId) ? action.attemptId : state.activeAttemptId ?? state.lastAttemptId;
|
|
1888
|
+
const cursor = resolvedAttemptId ? state.attemptsById.get(resolvedAttemptId) : void 0;
|
|
1885
1889
|
if (!cursor) return { state, operations: [] };
|
|
1886
1890
|
const next = copyState(state);
|
|
1887
|
-
if (next.activeAttemptId ===
|
|
1891
|
+
if (next.activeAttemptId === resolvedAttemptId) {
|
|
1888
1892
|
next.activeAttemptId = null;
|
|
1889
1893
|
}
|
|
1890
|
-
next.lastAttemptId =
|
|
1894
|
+
next.lastAttemptId = resolvedAttemptId;
|
|
1891
1895
|
return {
|
|
1892
1896
|
state: next,
|
|
1893
1897
|
operations: [{
|