fix(backend): Append prompt into the conversations output & Remove unused output pin on SmartDecisionBlock (#9550)

### Changes 🏗️

Append prompt into the conversations output & Remove unused output pin
on SmartDecisionBlock.

### Checklist 📋

#### For code changes:
- [ ] I have clearly listed my changes in the PR description
- [ ] I have made a test plan
- [ ] I have tested my changes according to the test plan:
  <!-- Put your test plan here: -->
  - [ ] ...

<details>
  <summary>Example test plan</summary>
  
  - [ ] Create from scratch and execute an agent with at least 3 blocks
- [ ] Import an agent from file upload, and confirm it executes
correctly
  - [ ] Upload agent to marketplace
- [ ] Import an agent from marketplace and confirm it executes correctly
  - [ ] Edit an agent from monitor, and confirm it executes correctly
</details>

#### For configuration changes:
- [ ] `.env.example` is updated or already compatible with my changes
- [ ] `docker-compose.yml` is updated or already compatible with my
changes
- [ ] I have included a list of my configuration changes in the PR
description (under **Changes**)

<details>
  <summary>Examples of configuration changes</summary>

  - Changing ports
  - Adding new services that need to communicate with each other
  - Secrets or environment variable changes
  - New or infrastructure changes such as databases
</details>
This commit is contained in:
Zamil Majdy
2025-03-01 20:52:20 +07:00
committed by GitHub
parent 91b1cc90aa
commit d3b83b79f9

View File

@@ -79,12 +79,7 @@ class SmartDecisionMakerBlock(Block):
)
class Output(BlockSchema):
prompt: str = SchemaField(description="The prompt sent to the language model.")
error: str = SchemaField(description="Error message if the API call failed.")
function_signatures: list[dict[str, Any]] = SchemaField(
description="The function signatures that are sent to the language model."
)
tools: Any = SchemaField(description="The tools that are available to use.")
finished: str = SchemaField(
description="The finished message to display to the user."
@@ -331,6 +326,9 @@ class SmartDecisionMakerBlock(Block):
for c in response.tool_calls
)
input_data.conversation_history.append(
llm.Message(role=llm.MessageRole.USER, content=response.prompt)
)
input_data.conversation_history.append(
llm.Message(role=llm.MessageRole.ASSISTANT, content=assistant_response)
)