Fix chat interface - restore continuous conversation flow

🎯 Major improvements to MissionControl component:
- Always keep input field visible and functional after AI responses
- Auto-clear input after submitting questions for better UX
- Add dynamic visual indicators (first question vs follow-up)
- Improve response layout with clear separation and hints
- Enable proper chat-like experience for continuous learning

🌟 Additional enhancements:
- Better language-specific messaging throughout interface
- Clearer visual hierarchy between input and response areas
- Intuitive flow that guides users to ask follow-up questions
- Maintains responsive design and accessibility

🔧 Technical changes:
- Enhanced MissionControl state management
- Improved component layout and styling
- Better TypeScript integration across components
- Updated tsconfig for stricter type checking
This commit is contained in:
rwiegand
2025-07-14 12:39:05 +02:00
parent b31492a354
commit f893530471
1798 changed files with 25329 additions and 92638 deletions

View File

@@ -1,17 +0,0 @@
export type Bytes = string | ArrayBuffer | Uint8Array | null | undefined;
/**
* A re-implementation of httpx's `LineDecoder` in Python that handles incrementally
* reading lines from text.
*
* https://github.com/encode/httpx/blob/920333ea98118e9cf617f246905d7b202510941c/httpx/_decoders.py#L258
*/
export declare class LineDecoder {
#private;
static NEWLINE_CHARS: Set<string>;
static NEWLINE_REGEXP: RegExp;
constructor();
decode(chunk: Bytes): string[];
flush(): string[];
}
export declare function findDoubleNewlineIndex(buffer: Uint8Array): number;
//# sourceMappingURL=line.d.mts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"line.d.mts","sourceRoot":"","sources":["../../src/internal/decoders/line.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC;AAEzE;;;;;GAKG;AACH,qBAAa,WAAW;;IAEtB,MAAM,CAAC,aAAa,cAAyB;IAC7C,MAAM,CAAC,cAAc,SAAkB;;IAUvC,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE;IA6C9B,KAAK,IAAI,MAAM,EAAE;CAMlB;AA+BD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CA6BjE"}

View File

@@ -1,4 +1,5 @@
export type Bytes = string | ArrayBuffer | Uint8Array | null | undefined;
export type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefined;
/**
* A re-implementation of httpx's `LineDecoder` in Python that handles incrementally
* reading lines from text.
@@ -9,8 +10,11 @@ export declare class LineDecoder {
#private;
static NEWLINE_CHARS: Set<string>;
static NEWLINE_REGEXP: RegExp;
buffer: Uint8Array;
textDecoder: any;
constructor();
decode(chunk: Bytes): string[];
decodeText(bytes: Bytes): string;
flush(): string[];
}
export declare function findDoubleNewlineIndex(buffer: Uint8Array): number;

View File

@@ -1 +1 @@
{"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../src/internal/decoders/line.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC;AAEzE;;;;;GAKG;AACH,qBAAa,WAAW;;IAEtB,MAAM,CAAC,aAAa,cAAyB;IAC7C,MAAM,CAAC,cAAc,SAAkB;;IAUvC,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE;IA6C9B,KAAK,IAAI,MAAM,EAAE;CAMlB;AA+BD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CA6BjE"}
{"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../src/internal/decoders/line.ts"],"names":[],"mappings":";AAEA,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAElF;;;;;GAKG;AACH,qBAAa,WAAW;;IAEtB,MAAM,CAAC,aAAa,cAAyB;IAC7C,MAAM,CAAC,cAAc,SAAkB;IAEvC,MAAM,EAAE,UAAU,CAAC;IAEnB,WAAW,EAAE,GAAG,CAAC;;IAOjB,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE;IAgD9B,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAqChC,KAAK,IAAI,MAAM,EAAE;CAMlB;AA+BD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CA6BjE"}

View File

@@ -1,10 +1,19 @@
"use strict";
var _LineDecoder_buffer, _LineDecoder_carriageReturnIndex;
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _LineDecoder_carriageReturnIndex;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LineDecoder = void 0;
exports.findDoubleNewlineIndex = findDoubleNewlineIndex;
const tslib_1 = require("../tslib.js");
const bytes_1 = require("../utils/bytes.js");
exports.findDoubleNewlineIndex = exports.LineDecoder = void 0;
const error_1 = require("../../error.js");
/**
* A re-implementation of httpx's `LineDecoder` in Python that handles incrementally
* reading lines from text.
@@ -13,52 +22,79 @@ const bytes_1 = require("../utils/bytes.js");
*/
class LineDecoder {
constructor() {
_LineDecoder_buffer.set(this, void 0);
_LineDecoder_carriageReturnIndex.set(this, void 0);
tslib_1.__classPrivateFieldSet(this, _LineDecoder_buffer, new Uint8Array(), "f");
tslib_1.__classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, null, "f");
this.buffer = new Uint8Array();
__classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, null, "f");
}
decode(chunk) {
if (chunk == null) {
return [];
}
const binaryChunk = chunk instanceof ArrayBuffer ? new Uint8Array(chunk)
: typeof chunk === 'string' ? (0, bytes_1.encodeUTF8)(chunk)
: typeof chunk === 'string' ? new TextEncoder().encode(chunk)
: chunk;
tslib_1.__classPrivateFieldSet(this, _LineDecoder_buffer, (0, bytes_1.concatBytes)([tslib_1.__classPrivateFieldGet(this, _LineDecoder_buffer, "f"), binaryChunk]), "f");
let newData = new Uint8Array(this.buffer.length + binaryChunk.length);
newData.set(this.buffer);
newData.set(binaryChunk, this.buffer.length);
this.buffer = newData;
const lines = [];
let patternIndex;
while ((patternIndex = findNewlineIndex(tslib_1.__classPrivateFieldGet(this, _LineDecoder_buffer, "f"), tslib_1.__classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f"))) != null) {
if (patternIndex.carriage && tslib_1.__classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") == null) {
while ((patternIndex = findNewlineIndex(this.buffer, __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f"))) != null) {
if (patternIndex.carriage && __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") == null) {
// skip until we either get a corresponding `\n`, a new `\r` or nothing
tslib_1.__classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, patternIndex.index, "f");
__classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, patternIndex.index, "f");
continue;
}
// we got double \r or \rtext\n
if (tslib_1.__classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") != null &&
(patternIndex.index !== tslib_1.__classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") + 1 || patternIndex.carriage)) {
lines.push((0, bytes_1.decodeUTF8)(tslib_1.__classPrivateFieldGet(this, _LineDecoder_buffer, "f").subarray(0, tslib_1.__classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") - 1)));
tslib_1.__classPrivateFieldSet(this, _LineDecoder_buffer, tslib_1.__classPrivateFieldGet(this, _LineDecoder_buffer, "f").subarray(tslib_1.__classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f")), "f");
tslib_1.__classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, null, "f");
if (__classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") != null &&
(patternIndex.index !== __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") + 1 || patternIndex.carriage)) {
lines.push(this.decodeText(this.buffer.slice(0, __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") - 1)));
this.buffer = this.buffer.slice(__classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f"));
__classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, null, "f");
continue;
}
const endIndex = tslib_1.__classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") !== null ? patternIndex.preceding - 1 : patternIndex.preceding;
const line = (0, bytes_1.decodeUTF8)(tslib_1.__classPrivateFieldGet(this, _LineDecoder_buffer, "f").subarray(0, endIndex));
const endIndex = __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") !== null ? patternIndex.preceding - 1 : patternIndex.preceding;
const line = this.decodeText(this.buffer.slice(0, endIndex));
lines.push(line);
tslib_1.__classPrivateFieldSet(this, _LineDecoder_buffer, tslib_1.__classPrivateFieldGet(this, _LineDecoder_buffer, "f").subarray(patternIndex.index), "f");
tslib_1.__classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, null, "f");
this.buffer = this.buffer.slice(patternIndex.index);
__classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, null, "f");
}
return lines;
}
decodeText(bytes) {
if (bytes == null)
return '';
if (typeof bytes === 'string')
return bytes;
// Node:
if (typeof Buffer !== 'undefined') {
if (bytes instanceof Buffer) {
return bytes.toString();
}
if (bytes instanceof Uint8Array) {
return Buffer.from(bytes).toString();
}
throw new error_1.OpenAIError(`Unexpected: received non-Uint8Array (${bytes.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`);
}
// Browser
if (typeof TextDecoder !== 'undefined') {
if (bytes instanceof Uint8Array || bytes instanceof ArrayBuffer) {
this.textDecoder ?? (this.textDecoder = new TextDecoder('utf8'));
return this.textDecoder.decode(bytes);
}
throw new error_1.OpenAIError(`Unexpected: received non-Uint8Array/ArrayBuffer (${bytes.constructor.name}) in a web platform. Please report this error.`);
}
throw new error_1.OpenAIError(`Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.`);
}
flush() {
if (!tslib_1.__classPrivateFieldGet(this, _LineDecoder_buffer, "f").length) {
if (!this.buffer.length) {
return [];
}
return this.decode('\n');
}
}
exports.LineDecoder = LineDecoder;
_LineDecoder_buffer = new WeakMap(), _LineDecoder_carriageReturnIndex = new WeakMap();
_LineDecoder_carriageReturnIndex = new WeakMap();
// prettier-ignore
LineDecoder.NEWLINE_CHARS = new Set(['\n', '\r']);
LineDecoder.NEWLINE_REGEXP = /\r\n|[\n\r]/g;
@@ -110,4 +146,5 @@ function findDoubleNewlineIndex(buffer) {
}
return -1;
}
exports.findDoubleNewlineIndex = findDoubleNewlineIndex;
//# sourceMappingURL=line.js.map

View File

@@ -1 +1 @@
{"version":3,"file":"line.js","sourceRoot":"","sources":["../../src/internal/decoders/line.ts"],"names":[],"mappings":";;;;AAyGA,wDA6BC;;AAtID,6CAAqE;AAIrE;;;;;GAKG;AACH,MAAa,WAAW;IAQtB;QAHA,sCAAoB;QACpB,mDAAoC;QAGlC,+BAAA,IAAI,uBAAW,IAAI,UAAU,EAAE,MAAA,CAAC;QAChC,+BAAA,IAAI,oCAAwB,IAAI,MAAA,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,KAAY;QACjB,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAClB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,WAAW,GACf,KAAK,YAAY,WAAW,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC;YACpD,CAAC,CAAC,OAAO,KAAK,KAAK,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AAC,CAAC,KAAK,OAAO,EACzB;YACA,WAAW;YACX,OAAO,CAAC,GAAG,CAAC,CAAC;SACd;KACF;IAED,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC;AA7BD,wDA6BC"}

View File

@@ -1,6 +1,16 @@
var _LineDecoder_buffer, _LineDecoder_carriageReturnIndex;
import { __classPrivateFieldGet, __classPrivateFieldSet } from "../tslib.mjs";
import { concatBytes, decodeUTF8, encodeUTF8 } from "../utils/bytes.mjs";
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _LineDecoder_carriageReturnIndex;
import { OpenAIError } from "../../error.mjs";
/**
* A re-implementation of httpx's `LineDecoder` in Python that handles incrementally
* reading lines from text.
@@ -9,9 +19,8 @@ import { concatBytes, decodeUTF8, encodeUTF8 } from "../utils/bytes.mjs";
*/
export class LineDecoder {
constructor() {
_LineDecoder_buffer.set(this, void 0);
_LineDecoder_carriageReturnIndex.set(this, void 0);
__classPrivateFieldSet(this, _LineDecoder_buffer, new Uint8Array(), "f");
this.buffer = new Uint8Array();
__classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, null, "f");
}
decode(chunk) {
@@ -19,12 +28,15 @@ export class LineDecoder {
return [];
}
const binaryChunk = chunk instanceof ArrayBuffer ? new Uint8Array(chunk)
: typeof chunk === 'string' ? encodeUTF8(chunk)
: typeof chunk === 'string' ? new TextEncoder().encode(chunk)
: chunk;
__classPrivateFieldSet(this, _LineDecoder_buffer, concatBytes([__classPrivateFieldGet(this, _LineDecoder_buffer, "f"), binaryChunk]), "f");
let newData = new Uint8Array(this.buffer.length + binaryChunk.length);
newData.set(this.buffer);
newData.set(binaryChunk, this.buffer.length);
this.buffer = newData;
const lines = [];
let patternIndex;
while ((patternIndex = findNewlineIndex(__classPrivateFieldGet(this, _LineDecoder_buffer, "f"), __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f"))) != null) {
while ((patternIndex = findNewlineIndex(this.buffer, __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f"))) != null) {
if (patternIndex.carriage && __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") == null) {
// skip until we either get a corresponding `\n`, a new `\r` or nothing
__classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, patternIndex.index, "f");
@@ -33,27 +45,52 @@ export class LineDecoder {
// we got double \r or \rtext\n
if (__classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") != null &&
(patternIndex.index !== __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") + 1 || patternIndex.carriage)) {
lines.push(decodeUTF8(__classPrivateFieldGet(this, _LineDecoder_buffer, "f").subarray(0, __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") - 1)));
__classPrivateFieldSet(this, _LineDecoder_buffer, __classPrivateFieldGet(this, _LineDecoder_buffer, "f").subarray(__classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f")), "f");
lines.push(this.decodeText(this.buffer.slice(0, __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") - 1)));
this.buffer = this.buffer.slice(__classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f"));
__classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, null, "f");
continue;
}
const endIndex = __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") !== null ? patternIndex.preceding - 1 : patternIndex.preceding;
const line = decodeUTF8(__classPrivateFieldGet(this, _LineDecoder_buffer, "f").subarray(0, endIndex));
const line = this.decodeText(this.buffer.slice(0, endIndex));
lines.push(line);
__classPrivateFieldSet(this, _LineDecoder_buffer, __classPrivateFieldGet(this, _LineDecoder_buffer, "f").subarray(patternIndex.index), "f");
this.buffer = this.buffer.slice(patternIndex.index);
__classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, null, "f");
}
return lines;
}
decodeText(bytes) {
if (bytes == null)
return '';
if (typeof bytes === 'string')
return bytes;
// Node:
if (typeof Buffer !== 'undefined') {
if (bytes instanceof Buffer) {
return bytes.toString();
}
if (bytes instanceof Uint8Array) {
return Buffer.from(bytes).toString();
}
throw new OpenAIError(`Unexpected: received non-Uint8Array (${bytes.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`);
}
// Browser
if (typeof TextDecoder !== 'undefined') {
if (bytes instanceof Uint8Array || bytes instanceof ArrayBuffer) {
this.textDecoder ?? (this.textDecoder = new TextDecoder('utf8'));
return this.textDecoder.decode(bytes);
}
throw new OpenAIError(`Unexpected: received non-Uint8Array/ArrayBuffer (${bytes.constructor.name}) in a web platform. Please report this error.`);
}
throw new OpenAIError(`Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.`);
}
flush() {
if (!__classPrivateFieldGet(this, _LineDecoder_buffer, "f").length) {
if (!this.buffer.length) {
return [];
}
return this.decode('\n');
}
}
_LineDecoder_buffer = new WeakMap(), _LineDecoder_carriageReturnIndex = new WeakMap();
_LineDecoder_carriageReturnIndex = new WeakMap();
// prettier-ignore
LineDecoder.NEWLINE_CHARS = new Set(['\n', '\r']);
LineDecoder.NEWLINE_REGEXP = /\r\n|[\n\r]/g;

View File

@@ -1 +1 @@
{"version":3,"file":"line.mjs","sourceRoot":"","sources":["../../src/internal/decoders/line.ts"],"names":[],"mappings":";;OAAO,EAAE,WAA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