mirror of https://github.com/buster-so/buster.git
Refactor sequential thinking tool to remove raw LLM message entries
- Removed the creation and handling of raw LLM message entries in both start and finish functions. - Updated message entry updates to only include reasoning messages, simplifying the logic and improving clarity.
This commit is contained in:
parent
50c9575d6f
commit
dcf1687b50
|
@ -1,10 +1,7 @@
|
|||
import { updateMessageEntries } from '@buster/database';
|
||||
import type { ToolCallOptions } from 'ai';
|
||||
import { normalizeEscapedText } from '../../../utils/streaming/escape-normalizer';
|
||||
import {
|
||||
createSequentialThinkingRawLlmMessageEntry,
|
||||
createSequentialThinkingReasoningMessage,
|
||||
} from './helpers/sequential-thinking-tool-transform-helper';
|
||||
import { createSequentialThinkingReasoningMessage } from './helpers/sequential-thinking-tool-transform-helper';
|
||||
import type {
|
||||
SequentialThinkingContext,
|
||||
SequentialThinkingInput,
|
||||
|
@ -31,22 +28,14 @@ export function createSequentialThinkingFinish(
|
|||
'completed' // Mark as completed when finish is called
|
||||
);
|
||||
|
||||
// Create final raw LLM message entry
|
||||
const rawLlmMessage = createSequentialThinkingRawLlmMessageEntry(
|
||||
sequentialThinkingState,
|
||||
options.toolCallId
|
||||
);
|
||||
|
||||
try {
|
||||
if (context.messageId) {
|
||||
const reasoningMessages = reasoningEntry ? [reasoningEntry] : [];
|
||||
const rawLlmMessages = rawLlmMessage ? [rawLlmMessage] : [];
|
||||
|
||||
if (reasoningMessages.length > 0 || rawLlmMessages.length > 0) {
|
||||
if (reasoningMessages.length > 0) {
|
||||
await updateMessageEntries({
|
||||
messageId: context.messageId,
|
||||
reasoningMessages,
|
||||
rawLlmMessages,
|
||||
});
|
||||
|
||||
console.info('[sequential-thinking] Completed sequential thinking:', {
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
import { updateMessageEntries } from '@buster/database';
|
||||
import type { ToolCallOptions } from 'ai';
|
||||
import {
|
||||
createSequentialThinkingRawLlmMessageEntry,
|
||||
createSequentialThinkingReasoningMessage,
|
||||
} from './helpers/sequential-thinking-tool-transform-helper';
|
||||
import { createSequentialThinkingReasoningMessage } from './helpers/sequential-thinking-tool-transform-helper';
|
||||
import type {
|
||||
SequentialThinkingContext,
|
||||
SequentialThinkingState,
|
||||
|
@ -29,22 +26,14 @@ export function createSequentialThinkingStart(
|
|||
options.toolCallId
|
||||
);
|
||||
|
||||
// Create initial raw LLM message entry
|
||||
const rawLlmMessage = createSequentialThinkingRawLlmMessageEntry(
|
||||
sequentialThinkingState,
|
||||
options.toolCallId
|
||||
);
|
||||
|
||||
try {
|
||||
if (context.messageId) {
|
||||
const reasoningMessages = reasoningEntry ? [reasoningEntry] : [];
|
||||
const rawLlmMessages = rawLlmMessage ? [rawLlmMessage] : [];
|
||||
|
||||
if (reasoningMessages.length > 0 || rawLlmMessages.length > 0) {
|
||||
if (reasoningMessages.length > 0) {
|
||||
await updateMessageEntries({
|
||||
messageId: context.messageId,
|
||||
reasoningMessages,
|
||||
rawLlmMessages,
|
||||
});
|
||||
|
||||
console.info('[sequential-thinking] Started sequential thinking:', {
|
||||
|
|
Loading…
Reference in New Issue