model_settings.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <pstm-uri>/models</pstm-uri>
  5. <pstm-template>main</pstm-template>
  6. </head>
  7. <body>
  8. <!-- Goal 41 T8: the model page on the Spry form conventions — the
  9. readiness line as an alert, the two endpoint groups as cards
  10. with capped-width fields (.form-rows), labelled controls.
  11. The form itself is unchanged (same stm-action, same
  12. write-only key handling); it was never an expander, so no
  13. dialog is needed — the page IS the editor. -->
  14. <div class="stack">
  15. <h2>Model</h2>
  16. <p class="text-muted">The deployment's model configuration: the OpenAI-compatible endpoint
  17. every saddle assignment is sent to, and the advisor's optional overrides. Stored
  18. in the database — environment variables no longer configure it (a pre-page
  19. deployment's SADDLE_LLM_* environment is imported once, on first read).</p>
  20. <p stm-if="model == null">Loading…</p>
  21. <div stm-if="model != null" class="stack">
  22. <p stm-if="!model.dispatch_ready" class="alert alert-warning"><span class="badge badge-offline">paused</span>
  23. No base URL is configured — task assignment is paused and
  24. the advisor is disabled until one is saved.</p>
  25. <p stm-if="model.dispatch_ready" class="alert alert-info"><span class="badge badge-done">ready</span>
  26. Updated <span stm-text="model.updated_display">when</span>.</p>
  27. <form stm-action="model.save" class="stack">
  28. <section class="card">
  29. <div class="card-header">
  30. <h3>Main endpoint</h3>
  31. <p class="text-muted">Used by every saddle assignment (the harness's LLM).</p>
  32. </div>
  33. <div class="card-body form-rows">
  34. <div class="field"><label for="model-base-url">Base URL</label>
  35. <input type="text" id="model-base-url" name="base_url" placeholder="http://127.0.0.1:9999/v1"
  36. stm-attribute.value="model.base_url"></div>
  37. <div class="field"><label for="model-name">Model</label>
  38. <input type="text" id="model-name" name="model" placeholder="(the provider's default)"
  39. stm-attribute.value="model.model"></div>
  40. <div class="field"><label for="model-api-key">API key</label>
  41. <input type="password" id="model-api-key" name="api_key" autocomplete="off"
  42. placeholder="Leave empty to keep the stored key">
  43. <span class="text-muted" stm-if="model.api_key_set">A key is stored
  44. (<span stm-text="model.api_key_hint">hint</span>)</span>
  45. <label class="choice"><input type="checkbox" name="clear_api_key" value="1"> Clear the stored key</label></div>
  46. </div>
  47. </section>
  48. <section class="card">
  49. <div class="card-header">
  50. <h3>Advisor endpoint <span class="text-muted">(optional)</span></h3>
  51. <p class="text-muted">Overrides for the AI Chat advisor. Leave the base URL empty to
  52. use the main endpoint's fields.</p>
  53. </div>
  54. <div class="card-body form-rows">
  55. <div class="field"><label for="advisor-base-url">Base URL</label>
  56. <input type="text" id="advisor-base-url" name="advisor_base_url" placeholder="(use the main endpoint)"
  57. stm-attribute.value="model.advisor_base_url"></div>
  58. <div class="field"><label for="advisor-model">Model</label>
  59. <input type="text" id="advisor-model" name="advisor_model" placeholder="(use the main endpoint's model)"
  60. stm-attribute.value="model.advisor_model"></div>
  61. <div class="field"><label for="advisor-api-key">API key</label>
  62. <input type="password" id="advisor-api-key" name="advisor_api_key" autocomplete="off"
  63. placeholder="Leave empty to keep the stored key">
  64. <span class="text-muted" stm-if="model.advisor_api_key_set">A key is stored
  65. (<span stm-text="model.advisor_api_key_hint">hint</span>)</span>
  66. <label class="choice"><input type="checkbox" name="clear_advisor_api_key" value="1"> Clear the stored key</label></div>
  67. </div>
  68. </section>
  69. <div><button type="submit" class="btn-primary">Save configuration</button></div>
  70. </form>
  71. </div>
  72. </div>
  73. </body>
  74. </html>