Everywhere icon indicating copy to clipboard operation
Everywhere copied to clipboard

replace magic strings with constants for model provider IDs

Open NeverMorewd opened this issue 1 month ago • 1 comments

  • Add ModelProviderIds static class with constants for all provider IDs
  • Update SupportedTemplates to use constants instead of string literals

NeverMorewd avatar Nov 19 '25 06:11 NeverMorewd

SupportedTemplates is more like a hard-coded configuration file where IDs are not reused, so encapsulating it offers no benefits.

DearVa avatar Nov 20 '25 04:11 DearVa

Maybe a enum is better? But I don't know if it may broke the settings save/load.

DearVa avatar Dec 03 '25 05:12 DearVa

@DearVa

We could technically preserve compatibility by keeping the Id as a string and adding an IdEnum field (ignored during serialization) for internal logic checks. However, after looking into the code, this approach seems unnecessarily complex and may introduce future risks — especially if we later support user-defined provider IDs. In that case, maintaining a conversion between enums and custom strings would become a hack-prone workaround.

NeverMorewd avatar Dec 04 '25 02:12 NeverMorewd