Repository navigation
Commit ab1e4fc
committed
Extract token counts into a dedicated component and display them below the prompt field
- create a new UI component: 'TokenCounts'. Should accept props: token_count: {selected_files, prompt} and translation keys: 'selected files', 'prompt'. Place below Prompt Field.
- these [Fragment] should live in a new file: main.ts
- in `apps/editor/src/views/prompt/frontend/Main/MainView/MainView.tsx` use `apps/editor/src/utils/display-token-count.ts`
- should be string [Fragment]
- to `packages/ui/src/components/editor/prompt/TokenCounts/TokenCounts.tsx` add 'edit format', calculate count properly based on current 'edit format'. also make it optional so that it is only provided in 'edit' prompt type.
- change order of items 'selected files','edit format','prompt'
- render one under another with a checkbox in disabled state
- render in a single row
- leave checkpoint only on 'selected files'
- place label and value in a separate div, with gap: 3px
- fix class names in `packages/ui/src/components/editor/prompt/TokenCounts/TokenCounts.tsx`
- merge 'edit format' token count into 'prompt'
- from prompt field, remove token count
- fix `packages/ui/src/components/editor/common/prompts/PromptField/PromptField.stories.tsx`
- rename 'edit format' to 'edit format instructions' (in translations, file names, etc.)
├── apps
│ └── editor
│ └── src
│ ├── constants
│ │ └── edit-format-instructions.ts
│ ├── i18n
│ │ └── translations
│ │ └── views
│ │ └── prompt
│ │ └── handlers
│ │ └── select-edit-format-instructions.ts
│ ├── utils
│ │ └── display-token-count.ts
│ └── views
│ └── prompt
│ ├── backend
│ │ ├── message-handlers
│ │ │ ├── handle-select-edit-format-instructions.ts
│ │ │ └── index.ts
│ │ └── prompt-view-provider.ts
│ ├── frontend
│ │ ├── Main
│ │ │ ├── Main.tsx
│ │ │ ├── MainView
│ │ │ │ ├── MainView.tsx
│ │ │ │ └── index.ts
│ │ │ └── index.ts
│ │ ├── Prompt.tsx
│ │ └── i18n
│ │ └── translations
│ │ ├── actions.ts
│ │ ├── configurations.ts
│ │ ├── footer.ts
│ │ ├── header.ts
│ │ ├── home.ts
│ │ ├── index.ts
│ │ ├── main.ts
│ │ ├── modals.ts
│ │ ├── prompt-field.ts
│ │ └── recent-donations.ts
│ └── types
│ └── messages.ts
└── packages
└── ui
└── src
└── components
└── editor
├── common
│ ├── Checkbox
│ │ ├── Checkbox.module.scss
│ │ ├── Checkbox.stories.tsx
│ │ ├── Checkbox.tsx
│ │ └── index.ts
│ └── prompts
│ └── PromptField
│ ├── PromptField.module.scss
│ ├── PromptField.stories.tsx
│ └── PromptField.tsx
└── prompt
├── Configurations
│ ├── Configurations.module.scss
│ ├── Configurations.stories.tsx
│ ├── Configurations.tsx
│ └── index.ts
└── TokenCounts
├── TokenCounts.module.scss
├── TokenCounts.tsx
└── index.ts1 parent e64871a commit ab1e4fc
18 files changed
Lines changed: 469 additions & 354 deletions
File tree
- apps/editor/src
- i18n/translations/views/prompt/handlers
- views/prompt
- backend
- message-handlers
- frontend
- Main
- MainView
- i18n/translations
- types
- packages/ui/src/components/editor
- common/prompts/PromptField
- prompt/TokenCounts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
0 commit comments