refactor: reorder postMessageProcessing parameters for clarity
Rearrange the `postMessageProcessing` signature so that `isProactiveMode` now precedes the internal `currentStepCount`. This change improves the logical flow of the API: the proactive flag is a public flag that callers should set, whereas the step counter is an internal bookkeeping value. The updated order also aligns the JSDoc comment with the implementation. All related tests were updated to reflect the new parameter order, and comments were adjusted to describe the internal counter in the correct place. No functional behavior changes occur; the change simply makes the API easier to read and maintain.
This commit is contained in:
parent
ef4e8bf353
commit
388a9f96ea
@ -673,7 +673,6 @@ describe('completion.ts', () => {
|
|||||||
[], // tools
|
[], // tools
|
||||||
undefined, // updateStreamingUI
|
undefined, // updateStreamingUI
|
||||||
undefined, // maxToolSteps
|
undefined, // maxToolSteps
|
||||||
undefined, // currentStepCount
|
|
||||||
true // isProactiveMode - Correctly set to true
|
true // isProactiveMode - Correctly set to true
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -733,7 +732,6 @@ describe('completion.ts', () => {
|
|||||||
[], // tools
|
[], // tools
|
||||||
undefined, // updateStreamingUI
|
undefined, // updateStreamingUI
|
||||||
undefined, // maxToolSteps
|
undefined, // maxToolSteps
|
||||||
undefined, // currentStepCount
|
|
||||||
false // isProactiveMode - Correctly set to false
|
false // isProactiveMode - Correctly set to false
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -788,7 +786,6 @@ describe('completion.ts', () => {
|
|||||||
[], // tools
|
[], // tools
|
||||||
undefined, // updateStreamingUI
|
undefined, // updateStreamingUI
|
||||||
undefined, // maxToolSteps
|
undefined, // maxToolSteps
|
||||||
undefined, // currentStepCount
|
|
||||||
true // isProactiveMode - Still set to true, but the non-browser tool should skip the proactive step
|
true // isProactiveMode - Still set to true, but the non-browser tool should skip the proactive step
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -534,8 +534,8 @@ const filterOldProactiveScreenshots = (builder: CompletionMessagesBuilder) => {
|
|||||||
* @param tools
|
* @param tools
|
||||||
* @param updateStreamingUI
|
* @param updateStreamingUI
|
||||||
* @param maxToolSteps
|
* @param maxToolSteps
|
||||||
* @param currentStepCount - Internal counter for recursive calls (do not set manually)
|
|
||||||
* @param isProactiveMode
|
* @param isProactiveMode
|
||||||
|
* @param currentStepCount - Internal counter for recursive calls (do not set manually)
|
||||||
*/
|
*/
|
||||||
export const postMessageProcessing = async (
|
export const postMessageProcessing = async (
|
||||||
calls: ChatCompletionMessageToolCall[],
|
calls: ChatCompletionMessageToolCall[],
|
||||||
@ -554,8 +554,8 @@ export const postMessageProcessing = async (
|
|||||||
tools: MCPTool[] = [],
|
tools: MCPTool[] = [],
|
||||||
updateStreamingUI?: (content: ThreadMessage) => void,
|
updateStreamingUI?: (content: ThreadMessage) => void,
|
||||||
maxToolSteps: number = 20,
|
maxToolSteps: number = 20,
|
||||||
currentStepCount: number = 0,
|
isProactiveMode: boolean = false,
|
||||||
isProactiveMode: boolean = false
|
currentStepCount: number = 0
|
||||||
): Promise<ThreadMessage> => {
|
): Promise<ThreadMessage> => {
|
||||||
// Initialize/get the current total thinking time from metadata
|
// Initialize/get the current total thinking time from metadata
|
||||||
// This value is passed from sendMessage (initial completion time) or previous recursive call
|
// This value is passed from sendMessage (initial completion time) or previous recursive call
|
||||||
@ -877,8 +877,8 @@ export const postMessageProcessing = async (
|
|||||||
tools,
|
tools,
|
||||||
updateStreamingUI,
|
updateStreamingUI,
|
||||||
maxToolSteps,
|
maxToolSteps,
|
||||||
|
isProactiveMode,
|
||||||
nextStepCount, // Pass the incremented step count
|
nextStepCount, // Pass the incremented step count
|
||||||
isProactiveMode
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user