Commit graph

1110 commits

Author SHA1 Message Date
Classic298
d93cb3658d
perf(models): batch-fetch function valves to eliminate N+1 queries (#22301)
* perf(models): batch-fetch function valves to eliminate N+1 queries

get_action_priority() called Functions.get_function_valves_by_id()
individually for every action on every model — an N+1 query pattern
that issued one DB round-trip per (action x model) pair.

Add Functions.get_function_valves_by_ids() that fetches all valves in
a single WHERE IN query, then look up each action's valves from the
pre-fetched dict inside get_action_priority().

No functional change — same priority resolution, same sort order.

* Update models.py

* Update models.py
2026-03-06 15:56:01 -06:00
Timothy Jaeryang Baek
4ab831b259 refac 2026-03-06 15:42:13 -06:00
Shamil
9cf6108527
feat: add otel system metrics instrumentation (#22265) 2026-03-06 14:24:24 -06:00
Erhhung Yuan
fa1ebfa4fd
fix: use same metric description as OTel (#22192) (#22293)
Signed-off-by: Erhhung Yuan <erhhung@gmail.com>
2026-03-06 13:58:25 -06:00
Timothy Jaeryang Baek
828656b35f feat: auto-refresh FileNav on write_file, replace_file_content, and run_command
Backend emits terminal events for write_file, replace_file_content,
and run_command. Frontend showFileNavDir subscriber uses startsWith
path matching to smartly refresh only when the event is relevant:
- write_file/replace_file_content: refresh if path is in current view
- run_command: always refresh (uses root '/' which matches everything)
- Also adds copy-to-clipboard button and code preview full-height fix
2026-03-05 14:41:18 -06:00
Timothy Jaeryang Baek
10daa64d5b chore: format 2026-03-02 17:26:18 -06:00
Timothy Jaeryang Baek
e0d4c3ec92 refac 2026-03-02 17:26:01 -06:00
Classic298
65fbbf5e35
fix: grant file access for knowledge attached to shared workspace models (#22151) 2026-03-02 18:08:49 -05:00
Timothy Jaeryang Baek
3de14a53c2 chore: format 2026-03-02 17:04:52 -06:00
Classic298
d040953c76
fix: omit None-valued query params in execute_tool_server (#22144) 2026-03-02 16:51:15 -06:00
Timothy Jaeryang Baek
64957db7b3 refac 2026-03-02 11:26:33 -06:00
Timothy Jaeryang Baek
2751a0f0b6 refac 2026-03-01 19:09:10 -06:00
Timothy Jaeryang Baek
93bab8d822 refac 2026-03-01 13:54:44 -06:00
Timothy Jaeryang Baek
259d5ca596 refac 2026-03-01 13:49:36 -06:00
Timothy Jaeryang Baek
ddedceb7ad refac 2026-03-01 12:32:44 -06:00
Timothy Jaeryang Baek
18865a9fef refac 2026-03-01 12:30:03 -06:00
Timothy Jaeryang Baek
1357dc6737 chore: format 2026-02-28 21:28:59 -06:00
Timothy Jaeryang Baek
668bd44485 refac 2026-02-28 20:22:24 -06:00
Timothy Jaeryang Baek
cfa16e1a37 refac 2026-02-27 16:37:33 -06:00
Timothy Jaeryang Baek
a677b212d9 refac 2026-02-27 16:03:12 -06:00
Timothy Jaeryang Baek
179a4ad9ea refac 2026-02-27 16:01:57 -06:00
Timothy Jaeryang Baek
965f242d16 refac 2026-02-27 15:53:03 -06:00
Timothy Jaeryang Baek
758d8fcf31 refac 2026-02-27 15:51:15 -06:00
Timothy Jaeryang Baek
0f8b339f6d refac 2026-02-27 15:48:55 -06:00
Timothy Jaeryang Baek
4737e1f118 feat: open terminal integration 2026-02-27 13:08:59 -06:00
Timothy Jaeryang Baek
345f3e3559 refac 2026-02-25 15:15:59 -06:00
Algorithm5838
b2413f914a
perf: early-return in get_tools() for empty tool_ids (#21873)
Avoids a needless Groups.get_groups_by_member_id() query when
no tools are attached to the request.
2026-02-25 13:13:18 -06:00
Timothy Jaeryang Baek
81781e6495 refac 2026-02-24 17:14:07 -06:00
Timothy Jaeryang Baek
9478c5e7ac refac 2026-02-24 17:04:07 -06:00
Classic298
5c403fb829
fix: resolve valve priority for actions and filters via class instantiation (#21841)
fix: resolve valve priority for actions and filters via class instantiation

The priority sorting for action buttons and filter execution order
read valve data directly from the database JSON column using
Functions.get_function_valves_by_id(). This returns only explicitly
saved values — when a developer defines priority as a class default
in their Valves definition (e.g. priority: int = 5) without ever
opening the Valves UI to persist it, the database column remains
empty. Every function then resolves to priority 0, and the preceding
set() deduplication produces non-deterministic iteration order that
the stable sort preserves — resulting in random button placement on
every page load.

The fix instantiates the Valves class with database values as keyword
overrides: Valves(**(db_valves or {})). This merges any persisted
overrides onto the code-defined defaults, matching the pattern already
established in the action execution handler, filter processing
pipeline, and tool module initialization. A secondary sort key (the
function ID) ensures fully deterministic ordering even when multiple
functions share the same priority value.

Affected locations:
- get_action_priority in utils/models.py (action button ordering)
- get_priority in utils/filter.py (filter execution ordering)
2026-02-24 15:58:23 -06:00
Timothy Jaeryang Baek
64ec73635b refac 2026-02-24 14:47:28 -06:00
Timothy Jaeryang Baek
e6fe3ba8ef refac 2026-02-23 18:23:47 -06:00
Timothy Jaeryang Baek
0b867590a8 refac 2026-02-23 18:23:34 -06:00
Timothy Jaeryang Baek
3c8d658160 fix: tools_dict issue 2026-02-23 16:25:38 -06:00
Timothy Jaeryang Baek
176f9a7816 refac 2026-02-23 16:01:03 -06:00
Classic298
1808d7fd2f
feat: sort action buttons by valve priority (#21790)
feat: sort action buttons by valve priority

Action buttons under assistant messages were rendered in
non-deterministic order due to set() deduplication. They now
respect the priority field from function Valves, sorted ascending
(lower value = appears first, default 0), matching the existing
filter priority mechanism.
2026-02-23 13:52:12 -06:00
Timothy Jaeryang Baek
f4a1d99f00 refac 2026-02-23 12:52:46 -06:00
Timothy Jaeryang Baek
8f49725aa5 refac 2026-02-23 12:17:36 -06:00
Jannik S.
140ab270af
fix: correct ENABLE_AUDIT_STDOUT stdout filter (#21777) 2026-02-23 11:52:29 -06:00
Timothy Jaeryang Baek
95bde946ba refac 2026-02-23 03:22:19 -06:00
Timothy Jaeryang Baek
9044abf3bb chore: format 2026-02-23 01:40:53 -06:00
Timothy Jaeryang Baek
424dba443c refac 2026-02-23 01:37:06 -06:00
Timothy Jaeryang Baek
6eba27ee9c refac 2026-02-22 18:00:16 -06:00
Timothy Jaeryang Baek
8f0658e64f fix: payload tools handling 2026-02-22 17:58:59 -06:00
Timothy Jaeryang Baek
becac2b2b7 refac 2026-02-22 17:51:08 -06:00
Andrei Efanov
9e81e1dda1
feat: add LOG_FORMAT=json for structured JSON logging (#21747)
* feat: add LOG_FORMAT env var with JSON formatter for early logging

Introduce LOG_FORMAT environment variable (set to "json" to enable).
When active, logging.basicConfig() uses a JSONFormatter that outputs
single-line JSON objects with fields: ts, level, msg, caller, error,
stacktrace. This covers all log messages emitted during module imports
before Loguru's start_logger() takes over.

* feat: add JSON sink for Loguru when LOG_FORMAT=json

Add _json_sink() as a Loguru sink function that writes single-line JSON
to stdout. In start_logger(), conditionally use the JSON sink instead of
the plain-text stdout_format when LOG_FORMAT is set to "json".

* feat: suppress ASCII banner and fix alembic logging in JSON mode

- Wrap the ASCII art banner print in main.py with a LOG_FORMAT != "json"
  guard so JSON output stays machine-parseable.
- Skip alembic's fileConfig() call in migrations/env.py when
  LOG_FORMAT=json to prevent it from replacing the JSON log handlers
  installed during early startup.
2026-02-22 17:40:17 -06:00
Timothy Jaeryang Baek
30a13b9b2f refac: ollama str think support 2026-02-22 17:11:50 -06:00
Timothy Jaeryang Baek
c341f97cfe feat: default model metadata & params 2026-02-22 16:54:34 -06:00
Timothy Jaeryang Baek
631e30e22d refac 2026-02-21 15:35:34 -06:00
Timothy Jaeryang Baek
4b9f821b58 enh: OAUTH_GROUP_DEFAULT_SHARE 2026-02-21 15:08:06 -06:00