Skip to content

Commit 8e1c980

Browse files
committed
remove log messages, robustify AMA
1 parent b1cb02a commit 8e1c980

File tree

7 files changed

+30
-17
lines changed

7 files changed

+30
-17
lines changed

mxgraph_component/mxgraph_component/frontend/src/diagram.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ class CustomHierarchicalLayout extends mx.mxHierarchicalLayout {
496496
export function layoutDiagram(graph: mxGraph) {
497497
graph.getModel().beginUpdate();
498498
try {
499-
console.log(graph)
499+
// console.log(graph)
500500

501501
// add an implicit edge from each node to the group of the target if that gropu is not the default parent
502502
const cells = graph.getChildCells(graph.getDefaultParent(), true, true);
@@ -538,7 +538,7 @@ export function layoutDiagram(graph: mxGraph) {
538538
graph.getModel().remove(edge);
539539
}
540540
}
541-
console.log(graph)
541+
// console.log(graph)
542542
} finally {
543543
graph.getModel().endUpdate();
544544
}

mxgraph_component/mxgraph_component/frontend/src/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,11 +1294,11 @@ function onRender(event: Event): void {
12941294
const data = (event as CustomEvent<RenderData>).detail;
12951295
const initial_render = currentDiagram === undefined;
12961296

1297-
console.log("currentDiagram === undefined", initial_render)
1298-
console.log("forced", data.args["forced"])
1299-
console.log("clear", data.args["clear"])
1300-
console.log("!editable", !data.args["editable"])
1301-
console.log("Force", initial_render || !data.args['editable'] || data.args["forced"] || data.args["clear"])
1297+
// console.log("currentDiagram === undefined", initial_render)
1298+
// console.log("forced", data.args["forced"])
1299+
// console.log("clear", data.args["clear"])
1300+
// console.log("!editable", !data.args["editable"])
1301+
// console.log("Force", initial_render || !data.args['editable'] || data.args["forced"] || data.args["clear"])
13021302

13031303

13041304
setEditable(false);

src/flowco/dataflow/dfg_update.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def update_dataflow_graph(
4343
Returns a new DataFlowGraph instance with the updates applied.
4444
"""
4545

46-
print(diagram_update)
46+
# print(diagram_update)
4747

4848
# Create deep copies of current nodes and edges to avoid mutation
4949
new_nodes_dict: Dict[str, Node] = {
@@ -188,7 +188,7 @@ def update_dataflow_graph(
188188
)
189189
for group in diagram_update.groups
190190
]
191-
print(groups)
191+
# print(groups)
192192

193193
new_graph = DataFlowGraph(
194194
description=current_graph.description,

src/flowco/dataflow/extended_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ def rep_to_summary(the_type: TypeRepresentation) -> str:
11331133
return "Record"
11341134
elif t == "pd.DataFrame":
11351135
return "DataFrame"
1136-
elif t in ["np.ndarray", "list", "set", "pd.Series"]:
1136+
elif t in ["np.ndarray", "List", "Set", "pd.Series"]:
11371137
return f"{t.capitalize()}[{rep_to_summary(the_type.element_type)}]"
11381138
elif t == "class":
11391139
return ext_type.the_type.name

src/flowco/page/output.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
ImageURL,
1919
)
2020

21+
from flowco.util.text import sandwich_text
22+
2123

2224
class OutputType(str, enum.Enum):
2325
text = "text"
@@ -284,8 +286,7 @@ class ResultOutput(BaseModel):
284286
def to_content_part(self) -> ChatCompletionContentPartParam:
285287
if self.output_type == OutputType.text:
286288
return ChatCompletionContentPartTextParam(
287-
type="text",
288-
text=self.data,
289+
type="text", text=sandwich_text(self.data, 50, 25)
289290
)
290291
elif self.output_type == OutputType.image:
291292
return ChatCompletionContentPartImageParam(

src/flowco/util/text.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,3 +354,16 @@ def black_format(code: List[str], line_length=70):
354354
except Exception as e:
355355
formatted_code = code_block
356356
return formatted_code.split("\n")
357+
358+
359+
def sandwich_text(text: str, max_lines: int = 1024, top_proportion: float = 0.5) -> str:
360+
if max_lines == None:
361+
return text
362+
lines = text.splitlines()
363+
if len(lines) <= max_lines:
364+
return text
365+
else:
366+
total_len = max_lines - 1 # some slop for the ...
367+
top_len = int(top_proportion * total_len)
368+
bot_start = len(lines) - (total_len - top_len)
369+
return "\n".join(lines[0:top_len] + [" [...] "] + lines[bot_start:])

src/llm/assistant.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,16 +232,15 @@ def make_call(
232232
self, tool_call: ChatCompletionMessageToolCall | ParsedFunctionToolCall
233233
) -> str:
234234
call_text = ""
235-
236235
call_id = tool_call.id
237236
function = tool_call.function
238237
function_name = function.name
239-
args = json.loads(function.arguments)
240-
function_def = self.functions[function_name]
238+
try:
239+
args = json.loads(function.arguments)
240+
function_def = self.functions[function_name]
241241

242-
self.logger.log(f"Tool call: {function_name}")
242+
self.logger.log(f"Tool call: {function_name}")
243243

244-
try:
245244
result = function_def.function(**args)
246245
except Exception as e:
247246
self.logger.error(f"Error in tool call {function_name}: {e}")

0 commit comments

Comments
 (0)