Hansimov commited on
Commit
6957609
1 Parent(s): d6474bb

:recycle: [Refactor] NewAgentModal: Generalize more wiget ids, and add description widget

Browse files
Files changed (1) hide show
  1. widgets/new_agent_modal_widget.js +18 -8
widgets/new_agent_modal_widget.js CHANGED
@@ -3,9 +3,14 @@ import { RangeNumberWidget } from "./range_number_widget.js";
3
  export class NewAgentModalWidget {
4
  constructor({ widget_id = null } = {}) {
5
  this.widget_id = widget_id;
 
 
 
6
  this.temperature_widget_id = `${this.widget_id}-temperature`;
7
  this.max_output_tokens_widget_id = `${this.widget_id}-max-output-tokens`;
8
  this.system_prompt_widget_id = `${this.widget_id}-system-prompt`;
 
 
9
  }
10
  spawn() {
11
  this.create_widget();
@@ -56,14 +61,19 @@ export class NewAgentModalWidget {
56
  </button>
57
  </div>
58
  <div class="modal-body">
59
- <!-- nickname -->
60
  <div class="form-floating mb-2">
61
- <input id="${this.widget_id}-nickname" class="form-control" type="text" placeholder="Nickname" />
62
- <label class="form-label">Nickname</label>
 
 
 
 
 
63
  </div>
64
  <!-- model -->
65
  <div class="form-floating mb-2">
66
- <select id="${this.widget_id}-model" class="form-select" type="text"></select>
67
  <label class="form-label">Model</label>
68
  </div>
69
  <!-- temperature -->
@@ -74,16 +84,15 @@ export class NewAgentModalWidget {
74
  </div>
75
  <!-- system prompt -->
76
  <div class="form-floating mb-2">
77
- <textarea id="${this.system_prompt_widget_id}" class="form-control" placeholder="System Prompt"
78
- rows="3"></textarea>
79
  <label>System Prompt</label>
80
  </div>
81
  <!-- max token -->
82
  <!-- max history messages token -->
83
  </div>
84
  <div class="modal-footer justify-content-end">
85
- <button id="new-agent-model-save-button" class="btn btn-success">Save</button>
86
- <button id="new-agent-model-close-button" class="btn btn-secondary"
87
  data-bs-dismiss="modal">Close</button>
88
  </div>
89
  </div>
@@ -109,5 +118,6 @@ export class NewAgentModalWidget {
109
  $(`#${this.system_prompt_widget_id}`)
110
  .css("resize", "none")
111
  .css("max-height", "200px");
 
112
  }
113
  }
 
3
  export class NewAgentModalWidget {
4
  constructor({ widget_id = null } = {}) {
5
  this.widget_id = widget_id;
6
+ this.name_widget_id = `${this.widget_id}-name`;
7
+ this.model_widget_id = `${this.widget_id}-model`;
8
+ this.description_widget_id = `${this.widget_id}-description`;
9
  this.temperature_widget_id = `${this.widget_id}-temperature`;
10
  this.max_output_tokens_widget_id = `${this.widget_id}-max-output-tokens`;
11
  this.system_prompt_widget_id = `${this.widget_id}-system-prompt`;
12
+ this.save_button_id = `${this.widget_id}-save-button`;
13
+ this.close_button_id = `${this.widget_id}-close-button`;
14
  }
15
  spawn() {
16
  this.create_widget();
 
61
  </button>
62
  </div>
63
  <div class="modal-body">
64
+ <!-- name -->
65
  <div class="form-floating mb-2">
66
+ <input id="${this.name_widget_id}" class="form-control" type="text"/>
67
+ <label class="form-label">Name</label>
68
+ </div>
69
+ <!-- description -->
70
+ <div class="form-floating mb-2">
71
+ <textarea id="${this.description_widget_id}" class="form-control" rows="1"></textarea>
72
+ <label>Description</label>
73
  </div>
74
  <!-- model -->
75
  <div class="form-floating mb-2">
76
+ <select id="${this.model_widget_id}" class="form-select" type="text"></select>
77
  <label class="form-label">Model</label>
78
  </div>
79
  <!-- temperature -->
 
84
  </div>
85
  <!-- system prompt -->
86
  <div class="form-floating mb-2">
87
+ <textarea id="${this.system_prompt_widget_id}" class="form-control" rows="3"></textarea>
 
88
  <label>System Prompt</label>
89
  </div>
90
  <!-- max token -->
91
  <!-- max history messages token -->
92
  </div>
93
  <div class="modal-footer justify-content-end">
94
+ <button id="${this.save_button_id}" class="btn btn-success">Save</button>
95
+ <button id="${this.close_button_id}" class="btn btn-secondary"
96
  data-bs-dismiss="modal">Close</button>
97
  </div>
98
  </div>
 
118
  $(`#${this.system_prompt_widget_id}`)
119
  .css("resize", "none")
120
  .css("max-height", "200px");
121
+ $(`#${this.description_widget_id}`).css("resize", "none");
122
  }
123
  }