brainiac-discord 0.0.21 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0867d7c12ec729c881db2a3a8dd9f02da284f677b3f7226a8771958b97da07b5'
4
- data.tar.gz: 073f0bbceca7c578ea06cd888c2e333b113efeede5ebde4b02b257247df15c9d
3
+ metadata.gz: 0c4e465a488b1eb8ff21dc46d539271cd85a35086fbed35a32e49bad609ee949
4
+ data.tar.gz: 5095805d24f0422c6ad9fe0ea7bb363965732b6d2b6df047d00295ce14b05194
5
5
  SHA512:
6
- metadata.gz: 5c103f0b92d230a5789424e41d9ea9881636a7ede849278db072c93b42c18ac42266ea264abb7128086e92e0639a042ff894460d9ee1405aabb5348d71918bda
7
- data.tar.gz: 2a236d41ec8676a4e3459bcd26bf5d47019a3f4cc5e67bfa4b1d2b8027c00e0803680c5ca37166285449d4a0f2ccffd7a0b81fde785a4ea977f476994aa158d3
6
+ metadata.gz: e8c98fba862167e6c12096161dfb5fd964b12c6cb938c767279b00c2002a0770993c0f3a68b6b9f35fd391fbecba83d19f6fb21b1d1972a05aad4adcd89c78ff
7
+ data.tar.gz: 37d9072132b6c961f15c7237f9b5bae98db6ddf0933f39ea9bfee4c9b983a85eb8b007e6cf2b11d8fc19fe75c261f733429cbad1827d124c4c47cbdaa811147e
@@ -714,8 +714,15 @@ module Brainiac
714
714
  end
715
715
 
716
716
  def resolve_overrides(clean_content, project_config, thread_model, thread_effort, thread_cli_provider)
717
- cli_provider = detect_cli_provider(text: clean_content) || thread_cli_provider
717
+ inline_cli = detect_cli_provider(text: clean_content)
718
+ cli_provider = inline_cli || thread_cli_provider
718
719
  has_explicit_model = explicit_model_tag?(clean_content, project_config, cli_provider_override: cli_provider)
720
+
721
+ # The stored model is a resolved ID from the previous provider's model map, so it
722
+ # means nothing to a different provider. Drop it on a switch and fall back to the
723
+ # new provider's default (unless this message also carries a model tag).
724
+ # Effort is kept: it's generic and gets clamped per provider anyway.
725
+ thread_model = nil if provider_switched?(inline_cli, thread_cli_provider)
719
726
  has_explicit_effort = clean_content.match?(/\[effort:\w+\]/i)
720
727
 
721
728
  model = if has_explicit_model
@@ -737,6 +744,10 @@ module Brainiac
737
744
  [model, effort, cli_provider]
738
745
  end
739
746
 
747
+ def provider_switched?(inline_cli, prev_cli_provider)
748
+ !inline_cli.nil? && inline_cli != prev_cli_provider
749
+ end
750
+
740
751
  # Persist inline overrides to the thread map (and work item map if a work item exists).
741
752
  # Only writes when a new inline tag was detected (differs from previously stored values).
742
753
  def persist_overrides(thread_map_key, clean_content, project_config,
@@ -761,7 +772,8 @@ module Brainiac
761
772
  entry = map[thread_map_key]
762
773
  if entry
763
774
  entry["cli_provider"] = cli_provider if inline_cli
764
- entry["model"] = model if inline_model
775
+ # Clear the old provider's model on a switch so it can't resurface later
776
+ entry["model"] = inline_model if inline_model || provider_switched?(inline_cli, prev_cli_provider)
765
777
  entry["effort"] = effort if inline_effort
766
778
  Config.save_thread_map(map)
767
779
  end
@@ -3,7 +3,7 @@
3
3
  module Brainiac
4
4
  module Plugins
5
5
  module Discord
6
- VERSION = "0.0.21"
6
+ VERSION = "0.0.22"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brainiac-discord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Davis