mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 01:07:46 +00:00
openspec/lightweight-tasks/task1-2-4-1-1.md
Add user envelope handling in runNonInteractive function
This commit is contained in:
@@ -201,6 +201,7 @@ export async function runNonInteractive(
|
||||
let initialPartList: PartListUnion | null = extractPartsFromEnvelope(
|
||||
options.userEnvelope,
|
||||
);
|
||||
let usedEnvelopeInput = initialPartList !== null;
|
||||
|
||||
if (!initialPartList) {
|
||||
let slashHandled = false;
|
||||
@@ -215,6 +216,7 @@ export async function runNonInteractive(
|
||||
// A slash command can replace the prompt entirely; fall back to @-command processing otherwise.
|
||||
initialPartList = slashCommandResult as PartListUnion;
|
||||
slashHandled = true;
|
||||
usedEnvelopeInput = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,17 +238,19 @@ export async function runNonInteractive(
|
||||
);
|
||||
}
|
||||
initialPartList = processedQuery as PartListUnion;
|
||||
usedEnvelopeInput = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!initialPartList) {
|
||||
initialPartList = [{ text: input }];
|
||||
usedEnvelopeInput = false;
|
||||
}
|
||||
|
||||
const initialParts = normalizePartList(initialPartList);
|
||||
let currentMessages: Content[] = [{ role: 'user', parts: initialParts }];
|
||||
|
||||
if (streamJsonWriter) {
|
||||
if (streamJsonWriter && !usedEnvelopeInput) {
|
||||
streamJsonWriter.emitUserMessageFromParts(initialParts);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user