Module: LlmCostTracker::DashboardFilterHelper
- Included in:
- ApplicationHelper
- Defined in:
- app/helpers/llm_cost_tracker/dashboard_filter_helper.rb
Constant Summary collapse
- FILTER_PARAM_KEYS =
%i[from to provider model stream usage_source tag].freeze
- STREAM_FILTER_OPTIONS =
[ ["Streaming only", "yes"], ["Non-streaming only", "no"] ].freeze
Instance Method Summary collapse
Instance Method Details
#active_tag_filters ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/helpers/llm_cost_tracker/dashboard_filter_helper.rb', line 16 def active_tag_filters tag_params = LlmCostTracker::Dashboard::Params.tag_query(params[:tag]) tag_params.filter_map do |key, value| { label: "Tag", value: "#{key}=#{value}", path: dashboard_filter_path(current_query(tag: tag_params.except(key).presence, page: nil)) } end end |
#any_filter_applied? ⇒ Boolean
12 13 14 |
# File 'app/helpers/llm_cost_tracker/dashboard_filter_helper.rb', line 12 def any_filter_applied? FILTER_PARAM_KEYS.any? { |key| params[key].present? } end |