mod_llm.go 802 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package llm
  2. import (
  3. "fmt"
  4. "yunion.io/x/jsonutils"
  5. "yunion.io/x/onecloud/pkg/mcclient"
  6. "yunion.io/x/onecloud/pkg/mcclient/modulebase"
  7. "yunion.io/x/onecloud/pkg/mcclient/modules"
  8. )
  9. var (
  10. LLMs LLMManager
  11. )
  12. func init() {
  13. LLMs = LLMManager{
  14. modules.NewLLMManager("llm", "llms",
  15. []string{},
  16. []string{}),
  17. }
  18. modules.Register(&LLMs)
  19. }
  20. type LLMManager struct {
  21. modulebase.ResourceManager
  22. }
  23. func (this *LLMManager) GetAvailableNetwork(session *mcclient.ClientSession, params jsonutils.JSONObject) (jsonutils.JSONObject, error) {
  24. path := fmt.Sprintf("/%s/available-network", this.KeywordPlural)
  25. if params != nil {
  26. qs := params.QueryString()
  27. if len(qs) > 0 {
  28. path = fmt.Sprintf("%s?%s", path, qs)
  29. }
  30. }
  31. return modulebase.Get(this.ResourceManager, session, path, this.Keyword)
  32. }