completion-kit 0.5.5 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/assets/javascripts/completion_kit/application.js +8 -4
- data/app/assets/stylesheets/completion_kit/application.css +201 -23
- data/app/controllers/completion_kit/prompts_controller.rb +1 -1
- data/app/controllers/completion_kit/runs_controller.rb +6 -0
- data/app/helpers/completion_kit/application_helper.rb +64 -10
- data/app/models/completion_kit/provider_credential.rb +8 -0
- data/app/services/completion_kit/worker_health.rb +4 -1
- data/app/views/completion_kit/api_reference/_authentication.html.erb +11 -0
- data/app/views/completion_kit/api_reference/_body.html.erb +311 -0
- data/app/views/completion_kit/api_reference/index.html.erb +6 -324
- data/app/views/completion_kit/prompts/_form.html.erb +6 -1
- data/app/views/completion_kit/prompts/index.html.erb +7 -0
- data/app/views/completion_kit/prompts/show.html.erb +65 -8
- data/app/views/completion_kit/provider_credentials/_models_card.html.erb +25 -20
- data/app/views/completion_kit/provider_credentials/index.html.erb +1 -0
- data/app/views/completion_kit/runs/_form.html.erb +2 -1
- data/app/views/completion_kit/runs/show.html.erb +1 -1
- data/app/views/completion_kit/tags/_picker.html.erb +1 -1
- data/app/views/layouts/completion_kit/application.html.erb +3 -2
- data/lib/completion_kit/version.rb +1 -1
- data/lib/completion_kit.rb +3 -0
- data/lib/generators/completion_kit/templates/initializer.rb +4 -0
- metadata +3 -1
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
<% token_display = if @token.present? && @token.length >= 12
|
|
2
|
-
"#{@token[0..3]}#{'•' * [@token.length - 8, 4].max}#{@token[-4..]}"
|
|
3
|
-
elsif @token.present?
|
|
4
|
-
"••••••••"
|
|
5
|
-
else
|
|
6
|
-
"YOUR_TOKEN"
|
|
7
|
-
end %>
|
|
8
|
-
|
|
9
1
|
<section class="ck-page-header">
|
|
10
2
|
<div>
|
|
11
3
|
<h1 class="ck-title">API</h1>
|
|
@@ -18,324 +10,14 @@ end %>
|
|
|
18
10
|
<div class="ck-split">
|
|
19
11
|
<div>
|
|
20
12
|
<p class="ck-kicker">Authentication</p>
|
|
21
|
-
|
|
22
|
-
<div style="display: flex; align-items: center; gap: 0.4rem; margin: 0.5rem 0;">
|
|
23
|
-
<button type="button" class="ck-chip ck-token-toggle" onclick="ckToggleToken(this)" data-masked="<%= token_display %>" data-real="<%= @token %>" aria-label="Reveal API token" aria-pressed="false" style="cursor: pointer;"><%= token_display %></button>
|
|
24
|
-
<button type="button" class="ck-icon-btn" title="Copy token" aria-label="Copy API token" onclick="var b=this;navigator.clipboard.writeText('<%= @token %>').then(function(){b.classList.add('ck-api-copy--done');setTimeout(function(){b.classList.remove('ck-api-copy--done')},1500)})">
|
|
25
|
-
<%= heroicon_tag "clipboard-document", variant: :outline, size: 14, "aria-hidden": "true" %>
|
|
26
|
-
</button>
|
|
27
|
-
</div>
|
|
28
|
-
<% else %>
|
|
29
|
-
<p class="ck-meta-copy">No API token configured. Set <code>COMPLETION_KIT_API_TOKEN</code> to enable API access.</p>
|
|
30
|
-
<% end %>
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<% if @published_prompts.any? %>
|
|
37
|
-
<div class="ck-api-prompts-section">
|
|
38
|
-
<p class="ck-kicker">Your prompts</p>
|
|
39
|
-
<% @published_prompts.each do |p| %>
|
|
40
|
-
<div class="ck-api-prompt-card">
|
|
41
|
-
<div class="ck-api-prompt-card__top">
|
|
42
|
-
<div>
|
|
43
|
-
<strong class="ck-api-prompt-card__name"><%= p.name %></strong>
|
|
44
|
-
<% if p.description.present? %>
|
|
45
|
-
<p class="ck-api-prompt-card__desc"><%= p.description %></p>
|
|
46
|
-
<% end %>
|
|
47
|
-
</div>
|
|
48
|
-
<span class="ck-chip" style="text-transform: none; flex-shrink: 0;"><%= p.llm_model %></span>
|
|
49
|
-
</div>
|
|
50
|
-
<div class="ck-api-prompt-card__url">
|
|
51
|
-
<code class="ck-endpoint__url" id="prompt_ep_<%= p.id %>"><%= @base_url %>/api/v1/prompts/<%= p.slug %></code>
|
|
52
|
-
<button type="button" class="ck-icon-btn" title="Copy endpoint" aria-label="Copy endpoint URL" onclick="navigator.clipboard.writeText(document.getElementById('prompt_ep_<%= p.id %>').textContent)"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="14" height="14" aria-hidden="true"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"/><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"/></svg></button>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
<% end %>
|
|
56
|
-
</div>
|
|
57
|
-
<% end %>
|
|
58
|
-
|
|
59
|
-
<div class="ck-api-tabs">
|
|
60
|
-
<input type="radio" name="ck-api-tab" id="ck-tab-mcp" class="ck-api-tabs__radio" checked>
|
|
61
|
-
<input type="radio" name="ck-api-tab" id="ck-tab-prompts" class="ck-api-tabs__radio">
|
|
62
|
-
<input type="radio" name="ck-api-tab" id="ck-tab-runs" class="ck-api-tabs__radio">
|
|
63
|
-
<input type="radio" name="ck-api-tab" id="ck-tab-responses" class="ck-api-tabs__radio">
|
|
64
|
-
<input type="radio" name="ck-api-tab" id="ck-tab-datasets" class="ck-api-tabs__radio">
|
|
65
|
-
<input type="radio" name="ck-api-tab" id="ck-tab-metrics" class="ck-api-tabs__radio">
|
|
66
|
-
<input type="radio" name="ck-api-tab" id="ck-tab-metric-groups" class="ck-api-tabs__radio">
|
|
67
|
-
<input type="radio" name="ck-api-tab" id="ck-tab-tags" class="ck-api-tabs__radio">
|
|
68
|
-
<input type="radio" name="ck-api-tab" id="ck-tab-providers" class="ck-api-tabs__radio">
|
|
69
|
-
|
|
70
|
-
<nav class="ck-api-tabs__nav">
|
|
71
|
-
<label for="ck-tab-mcp" class="ck-api-tabs__label">MCP <span class="ck-api-tabs__count">35</span></label>
|
|
72
|
-
<label for="ck-tab-prompts" class="ck-api-tabs__label">Prompts <span class="ck-api-tabs__count">6</span></label>
|
|
73
|
-
<label for="ck-tab-runs" class="ck-api-tabs__label">Runs <span class="ck-api-tabs__count">7</span></label>
|
|
74
|
-
<label for="ck-tab-responses" class="ck-api-tabs__label">Responses <span class="ck-api-tabs__count">2</span></label>
|
|
75
|
-
<label for="ck-tab-datasets" class="ck-api-tabs__label">Datasets <span class="ck-api-tabs__count">5</span></label>
|
|
76
|
-
<label for="ck-tab-metrics" class="ck-api-tabs__label">Metrics <span class="ck-api-tabs__count">5</span></label>
|
|
77
|
-
<label for="ck-tab-metric-groups" class="ck-api-tabs__label">Metric Groups <span class="ck-api-tabs__count">5</span></label>
|
|
78
|
-
<label for="ck-tab-tags" class="ck-api-tabs__label">Tags <span class="ck-api-tabs__count">5</span></label>
|
|
79
|
-
<label for="ck-tab-providers" class="ck-api-tabs__label">Providers <span class="ck-api-tabs__count">5</span></label>
|
|
80
|
-
</nav>
|
|
81
|
-
|
|
82
|
-
<div class="ck-api-tabs__panels">
|
|
83
|
-
|
|
84
|
-
<div class="ck-api-tabs__panel">
|
|
85
|
-
<h2 class="ck-section-title">MCP Server</h2>
|
|
86
|
-
<p class="ck-copy">Connect Claude Code, Cursor, or any <a href="https://modelcontextprotocol.io" class="ck-link">MCP</a> client to manage prompts, runs, datasets, and metrics conversationally. 35 tools over streamable HTTP.</p>
|
|
87
|
-
|
|
88
|
-
<div class="ck-mcp-install-grid">
|
|
89
|
-
<div class="ck-mcp-install-card">
|
|
90
|
-
<div class="ck-mcp-install-card__header">
|
|
91
|
-
<span class="ck-mcp-install-card__icon">▶</span>
|
|
92
|
-
Claude Code
|
|
93
|
-
</div>
|
|
94
|
-
<%= render "example", base_url: @base_url, token: token_display, real_token: @token, cmd: "claude mcp add completion-kit \\\n --transport http \\\n --url #{@base_url}/mcp \\\n --header \"Authorization: Bearer #{token_display}\"" %>
|
|
95
|
-
</div>
|
|
96
|
-
<div class="ck-mcp-install-card">
|
|
97
|
-
<div class="ck-mcp-install-card__header">
|
|
98
|
-
<span class="ck-mcp-install-card__icon">{}</span>
|
|
99
|
-
Cursor / Generic
|
|
100
|
-
</div>
|
|
101
|
-
<%= render "example", base_url: @base_url, token: token_display, real_token: @token, cmd: "{\n \"mcpServers\": {\n \"completion-kit\": {\n \"url\": \"#{@base_url}/mcp\",\n \"headers\": {\n \"Authorization\": \"Bearer #{token_display}\"\n }\n }\n }\n}" %>
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
104
|
-
|
|
105
|
-
<div class="ck-api-endpoint" style="padding-top: 1.5rem;">
|
|
106
|
-
<p class="ck-kicker" style="margin-bottom: 0.75rem;">Available tools</p>
|
|
107
|
-
<% grouped = CompletionKit::McpDispatcher.tool_definitions.group_by { |t| t[:name].split("_").first } %>
|
|
108
|
-
<% grouped.each do |group, tools| %>
|
|
109
|
-
<div class="ck-mcp-tool-group">
|
|
110
|
-
<p class="ck-mcp-tool-group__label"><%= group %> <span class="ck-api-tabs__count"><%= tools.size %></span></p>
|
|
111
|
-
<div class="ck-mcp-tools">
|
|
112
|
-
<% tools.each do |tool| %>
|
|
113
|
-
<div class="ck-mcp-tool">
|
|
114
|
-
<code class="ck-mcp-tool__name"><%= tool[:name] %></code>
|
|
115
|
-
<span class="ck-mcp-tool__desc"><%= tool[:description] %></span>
|
|
116
|
-
</div>
|
|
117
|
-
<% end %>
|
|
118
|
-
</div>
|
|
119
|
-
</div>
|
|
120
|
-
<% end %>
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
|
|
124
|
-
<div class="ck-api-tabs__panel">
|
|
125
|
-
<h2 class="ck-section-title">Prompts</h2>
|
|
126
|
-
<p class="ck-copy">Create, version, and manage LLM prompt templates.</p>
|
|
127
|
-
<div class="ck-api-endpoint">
|
|
128
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">GET</span> /api/v1/prompts</p>
|
|
129
|
-
<p class="ck-meta-copy">List all prompts, ordered by most recent.</p>
|
|
130
|
-
<%= render "example", base_url: @base_url, token: token_display, real_token: @token, cmd: "curl #{@base_url}/api/v1/prompts \\\n -H \"Authorization: Bearer #{token_display}\"" %>
|
|
131
|
-
</div>
|
|
132
|
-
<div class="ck-api-endpoint">
|
|
133
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">POST</span> /api/v1/prompts</p>
|
|
134
|
-
<p class="ck-meta-copy">Create a new prompt.</p>
|
|
135
|
-
<p class="ck-api-params"><strong>Required:</strong> <code>name</code>, <code>template</code>, <code>llm_model</code> <strong>Optional:</strong> <code>description</code></p>
|
|
136
|
-
<%= render "example", base_url: @base_url, token: token_display, real_token: @token, cmd: "curl -X POST #{@base_url}/api/v1/prompts \\\n -H \"Authorization: Bearer #{token_display}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"name\": \"summarizer\", \"template\": \"Summarize: {{text}}\", \"llm_model\": \"gpt-4.1\"}'" %>
|
|
137
|
-
</div>
|
|
138
|
-
<div class="ck-api-endpoint">
|
|
139
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">GET</span> /api/v1/prompts/:id</p>
|
|
140
|
-
<p class="ck-meta-copy">Get a single prompt by ID.</p>
|
|
141
|
-
</div>
|
|
142
|
-
<div class="ck-api-endpoint">
|
|
143
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">PATCH</span> /api/v1/prompts/:id</p>
|
|
144
|
-
<p class="ck-meta-copy">Update a prompt. Accepts same params as create.</p>
|
|
145
|
-
</div>
|
|
146
|
-
<div class="ck-api-endpoint">
|
|
147
|
-
<p class="ck-api-method"><span class="ck-chip" style="color: var(--ck-danger);">DELETE</span> /api/v1/prompts/:id</p>
|
|
148
|
-
<p class="ck-meta-copy">Delete a prompt. Returns 204 No Content.</p>
|
|
149
|
-
</div>
|
|
150
|
-
<div class="ck-api-endpoint">
|
|
151
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">POST</span> /api/v1/prompts/:id/publish</p>
|
|
152
|
-
<p class="ck-meta-copy">Publish a prompt version, making it the current version in its family.</p>
|
|
153
|
-
</div>
|
|
154
|
-
</div>
|
|
155
|
-
|
|
156
|
-
<div class="ck-api-tabs__panel">
|
|
157
|
-
<h2 class="ck-section-title">Runs</h2>
|
|
158
|
-
<p class="ck-copy">Create runs, generate LLM responses, and judge them with metrics.</p>
|
|
159
|
-
<div class="ck-api-endpoint">
|
|
160
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">GET</span> /api/v1/runs</p>
|
|
161
|
-
<p class="ck-meta-copy">List all runs with response counts and average scores.</p>
|
|
162
|
-
</div>
|
|
163
|
-
<div class="ck-api-endpoint">
|
|
164
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">POST</span> /api/v1/runs</p>
|
|
165
|
-
<p class="ck-meta-copy">Create a new run.</p>
|
|
166
|
-
<p class="ck-api-params"><strong>Required:</strong> <code>prompt_id</code> <strong>Optional:</strong> <code>name</code>, <code>dataset_id</code>, <code>metric_ids</code>, <code>judge_model</code></p>
|
|
167
|
-
<%= render "example", base_url: @base_url, token: token_display, real_token: @token, cmd: "curl -X POST #{@base_url}/api/v1/runs \\\n -H \"Authorization: Bearer #{token_display}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"prompt_id\": 1, \"dataset_id\": 1, \"metric_ids\": [1, 2]}'" %>
|
|
168
|
-
</div>
|
|
169
|
-
<div class="ck-api-endpoint">
|
|
170
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">GET</span> /api/v1/runs/:id</p>
|
|
171
|
-
<p class="ck-meta-copy">Get a run with status, progress, response count, and average score.</p>
|
|
172
|
-
<%= render "example", base_url: @base_url, token: token_display, real_token: @token, cmd: "curl #{@base_url}/api/v1/runs/1 \\\n -H \"Authorization: Bearer #{token_display}\"" %>
|
|
173
|
-
</div>
|
|
174
|
-
<div class="ck-api-endpoint">
|
|
175
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">POST</span> /api/v1/runs/:id/generate</p>
|
|
176
|
-
<p class="ck-meta-copy">Start generating responses. Returns 202 Accepted. Poll the run to check progress.</p>
|
|
177
|
-
<%= render "example", base_url: @base_url, token: token_display, real_token: @token, cmd: "curl -X POST #{@base_url}/api/v1/runs/1/generate \\\n -H \"Authorization: Bearer #{token_display}\"" %>
|
|
178
|
-
</div>
|
|
179
|
-
<div class="ck-api-endpoint">
|
|
180
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">PATCH</span> /api/v1/runs/:id</p>
|
|
181
|
-
<p class="ck-meta-copy">Update a run. Accepts same params as create.</p>
|
|
182
|
-
</div>
|
|
183
|
-
<div class="ck-api-endpoint">
|
|
184
|
-
<p class="ck-api-method"><span class="ck-chip" style="color: var(--ck-danger);">DELETE</span> /api/v1/runs/:id</p>
|
|
185
|
-
<p class="ck-meta-copy">Delete a run and all its responses. Returns 204 No Content.</p>
|
|
186
|
-
</div>
|
|
187
|
-
</div>
|
|
188
|
-
|
|
189
|
-
<div class="ck-api-tabs__panel">
|
|
190
|
-
<h2 class="ck-section-title">Responses</h2>
|
|
191
|
-
<p class="ck-copy">Read-only access to generated responses and their review scores. Nested under runs.</p>
|
|
192
|
-
<div class="ck-api-endpoint">
|
|
193
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">GET</span> /api/v1/runs/:run_id/responses</p>
|
|
194
|
-
<p class="ck-meta-copy">List all responses for a run, including nested review scores.</p>
|
|
195
|
-
<%= render "example", base_url: @base_url, token: token_display, real_token: @token, cmd: "curl #{@base_url}/api/v1/runs/1/responses \\\n -H \"Authorization: Bearer #{token_display}\"" %>
|
|
196
|
-
</div>
|
|
197
|
-
<div class="ck-api-endpoint">
|
|
198
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">GET</span> /api/v1/runs/:run_id/responses/:id</p>
|
|
199
|
-
<p class="ck-meta-copy">Get a single response with its review scores and feedback.</p>
|
|
200
|
-
</div>
|
|
201
|
-
</div>
|
|
202
|
-
|
|
203
|
-
<div class="ck-api-tabs__panel">
|
|
204
|
-
<h2 class="ck-section-title">Datasets</h2>
|
|
205
|
-
<p class="ck-copy">Data used as input for runs.</p>
|
|
206
|
-
<div class="ck-api-endpoint">
|
|
207
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">GET</span> /api/v1/datasets</p>
|
|
208
|
-
<p class="ck-meta-copy">List all datasets.</p>
|
|
209
|
-
</div>
|
|
210
|
-
<div class="ck-api-endpoint">
|
|
211
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">POST</span> /api/v1/datasets</p>
|
|
212
|
-
<p class="ck-meta-copy">Create a dataset.</p>
|
|
213
|
-
<p class="ck-api-params"><strong>Required:</strong> <code>name</code>, <code>csv_data</code></p>
|
|
214
|
-
<%= render "example", base_url: @base_url, token: token_display, real_token: @token, cmd: "curl -X POST #{@base_url}/api/v1/datasets \\\n -H \"Authorization: Bearer #{token_display}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"name\": \"tickets\", \"csv_data\": \"text,expected_output\\\\nHello,Hi\"}'" %>
|
|
215
|
-
</div>
|
|
216
|
-
<div class="ck-api-endpoint">
|
|
217
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">GET</span> <span class="ck-chip ck-chip--soft">PATCH</span> <span class="ck-chip" style="color: var(--ck-danger);">DELETE</span> /api/v1/datasets/:id</p>
|
|
218
|
-
<p class="ck-meta-copy">Get, update, or delete a dataset.</p>
|
|
219
|
-
</div>
|
|
220
|
-
</div>
|
|
221
|
-
|
|
222
|
-
<div class="ck-api-tabs__panel">
|
|
223
|
-
<h2 class="ck-section-title">Metrics</h2>
|
|
224
|
-
<p class="ck-copy">Scoring dimensions used by the judge model.</p>
|
|
225
|
-
<div class="ck-api-endpoint">
|
|
226
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">GET</span> /api/v1/metrics</p>
|
|
227
|
-
<p class="ck-meta-copy">List all metrics.</p>
|
|
228
|
-
</div>
|
|
229
|
-
<div class="ck-api-endpoint">
|
|
230
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">POST</span> /api/v1/metrics</p>
|
|
231
|
-
<p class="ck-meta-copy">Create a metric.</p>
|
|
232
|
-
<p class="ck-api-params"><strong>Required:</strong> <code>name</code> <strong>Optional:</strong> <code>instruction</code>, <code>rubric_bands</code> (array of {stars, description})</p>
|
|
233
|
-
<%= render "example", base_url: @base_url, token: token_display, real_token: @token, cmd: "curl -X POST #{@base_url}/api/v1/metrics \\\n -H \"Authorization: Bearer #{token_display}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"name\": \"relevance\", \"instruction\": \"Is the response relevant?\"}'" %>
|
|
234
|
-
</div>
|
|
235
|
-
<div class="ck-api-endpoint">
|
|
236
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">GET</span> <span class="ck-chip ck-chip--soft">PATCH</span> <span class="ck-chip" style="color: var(--ck-danger);">DELETE</span> /api/v1/metrics/:id</p>
|
|
237
|
-
<p class="ck-meta-copy">Get, update, or delete a metric.</p>
|
|
238
|
-
</div>
|
|
239
|
-
</div>
|
|
240
|
-
|
|
241
|
-
<div class="ck-api-tabs__panel">
|
|
242
|
-
<h2 class="ck-section-title">Metric Groups</h2>
|
|
243
|
-
<p class="ck-copy">Named groups of metrics you can apply to a run as a set.</p>
|
|
244
|
-
<div class="ck-api-endpoint">
|
|
245
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">GET</span> /api/v1/metric_groups</p>
|
|
246
|
-
<p class="ck-meta-copy">List all metric groups with their metric IDs.</p>
|
|
247
|
-
</div>
|
|
248
|
-
<div class="ck-api-endpoint">
|
|
249
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">POST</span> /api/v1/metric_groups</p>
|
|
250
|
-
<p class="ck-meta-copy">Create a metric group.</p>
|
|
251
|
-
<p class="ck-api-params"><strong>Required:</strong> <code>name</code> <strong>Optional:</strong> <code>description</code>, <code>metric_ids</code> (array)</p>
|
|
252
|
-
</div>
|
|
253
|
-
<div class="ck-api-endpoint">
|
|
254
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">GET</span> <span class="ck-chip ck-chip--soft">PATCH</span> <span class="ck-chip" style="color: var(--ck-danger);">DELETE</span> /api/v1/metric_groups/:id</p>
|
|
255
|
-
<p class="ck-meta-copy">Get, update, or delete a metric group. PATCH with <code>metric_ids</code> replaces all metric associations.</p>
|
|
256
|
-
</div>
|
|
257
|
-
</div>
|
|
258
|
-
|
|
259
|
-
<div class="ck-api-tabs__panel">
|
|
260
|
-
<h2 class="ck-section-title">Tags</h2>
|
|
261
|
-
<p class="ck-copy">Domain labels you can attach to metrics, prompts, runs, and datasets. Tags are auto-assigned a color from a 10-color palette. Each index page can be filtered by one or more tags using <code>?tag[]=name</code> query params (OR semantics).</p>
|
|
262
|
-
<div class="ck-api-endpoint">
|
|
263
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">GET</span> /api/v1/tags</p>
|
|
264
|
-
<p class="ck-meta-copy">List all tags with name and color.</p>
|
|
265
|
-
<%= render "example", base_url: @base_url, token: token_display, real_token: @token, cmd: "curl #{@base_url}/api/v1/tags \\\n -H \"Authorization: Bearer #{token_display}\"" %>
|
|
266
|
-
</div>
|
|
267
|
-
<div class="ck-api-endpoint">
|
|
268
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">POST</span> /api/v1/tags</p>
|
|
269
|
-
<p class="ck-meta-copy">Create a tag.</p>
|
|
270
|
-
<p class="ck-api-params"><strong>Required:</strong> <code>name</code></p>
|
|
271
|
-
<%= render "example", base_url: @base_url, token: token_display, real_token: @token, cmd: "curl -X POST #{@base_url}/api/v1/tags \\\n -H \"Authorization: Bearer #{token_display}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"name\": \"real estate\"}'" %>
|
|
272
|
-
</div>
|
|
273
|
-
<div class="ck-api-endpoint">
|
|
274
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">GET</span> <span class="ck-chip ck-chip--soft">PATCH</span> <span class="ck-chip" style="color: var(--ck-danger);">DELETE</span> /api/v1/tags/:id</p>
|
|
275
|
-
<p class="ck-meta-copy">Get, update, or delete a tag. PATCH accepts <code>name</code>. DELETE returns 204 No Content and removes all taggings for this tag.</p>
|
|
276
|
-
</div>
|
|
277
|
-
<div class="ck-api-endpoint" style="padding-top: 1rem;">
|
|
278
|
-
<p class="ck-kicker" style="margin-bottom: 0.5rem;">Tagging resources</p>
|
|
279
|
-
<p class="ck-meta-copy">Metrics, prompts, runs, and datasets accept a <code>tag_names</code> array on their create and update endpoints. Passing a name that does not yet exist silently creates the tag. On PATCH, the list replaces all existing tags for that record (omit the field to leave tags unchanged).</p>
|
|
280
|
-
<%= render "example", base_url: @base_url, token: token_display, real_token: @token, cmd: "curl -X POST #{@base_url}/api/v1/metrics \\\n -H \"Authorization: Bearer #{token_display}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"name\": \"Accuracy\", \"tag_names\": [\"real estate\"]}'" %>
|
|
281
|
-
</div>
|
|
282
|
-
<div class="ck-api-endpoint" style="padding-top: 1rem;">
|
|
283
|
-
<p class="ck-kicker" style="margin-bottom: 0.5rem;">MCP tools</p>
|
|
284
|
-
<div class="ck-mcp-tools">
|
|
285
|
-
<div class="ck-mcp-tool"><code class="ck-mcp-tool__name">tags_list</code><span class="ck-mcp-tool__desc">List all tags</span></div>
|
|
286
|
-
<div class="ck-mcp-tool"><code class="ck-mcp-tool__name">tags_get</code><span class="ck-mcp-tool__desc">Get a tag by ID</span></div>
|
|
287
|
-
<div class="ck-mcp-tool"><code class="ck-mcp-tool__name">tags_create</code><span class="ck-mcp-tool__desc">Create a tag (name required)</span></div>
|
|
288
|
-
<div class="ck-mcp-tool"><code class="ck-mcp-tool__name">tags_update</code><span class="ck-mcp-tool__desc">Update a tag's name</span></div>
|
|
289
|
-
<div class="ck-mcp-tool"><code class="ck-mcp-tool__name">tags_delete</code><span class="ck-mcp-tool__desc">Delete a tag and remove all its taggings</span></div>
|
|
290
|
-
</div>
|
|
291
|
-
<p class="ck-meta-copy" style="margin-top: 0.75rem;">The existing <code>metrics_create</code>, <code>metrics_update</code>, <code>prompts_create</code>, <code>prompts_update</code>, <code>runs_create</code>, <code>runs_update</code>, <code>datasets_create</code>, and <code>datasets_update</code> tools all accept a <code>tag_names</code> parameter with the same auto-create and replace semantics as the REST API.</p>
|
|
292
|
-
</div>
|
|
293
|
-
</div>
|
|
294
|
-
|
|
295
|
-
<div class="ck-api-tabs__panel">
|
|
296
|
-
<h2 class="ck-section-title">Provider Credentials</h2>
|
|
297
|
-
<p class="ck-copy">LLM provider API keys. The <code>api_key</code> field is write-only and never returned in responses.</p>
|
|
298
|
-
<div class="ck-api-endpoint">
|
|
299
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">GET</span> /api/v1/provider_credentials</p>
|
|
300
|
-
<p class="ck-meta-copy">List all provider credentials (api_key excluded).</p>
|
|
301
|
-
</div>
|
|
302
|
-
<div class="ck-api-endpoint">
|
|
303
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">POST</span> /api/v1/provider_credentials</p>
|
|
304
|
-
<p class="ck-meta-copy">Create a provider credential.</p>
|
|
305
|
-
<p class="ck-api-params"><strong>Required:</strong> <code>provider</code> (openai, anthropic, ollama, openrouter), <code>api_key</code> <strong>Optional:</strong> <code>api_endpoint</code></p>
|
|
306
|
-
</div>
|
|
307
|
-
<div class="ck-api-endpoint">
|
|
308
|
-
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">GET</span> <span class="ck-chip ck-chip--soft">PATCH</span> <span class="ck-chip" style="color: var(--ck-danger);">DELETE</span> /api/v1/provider_credentials/:id</p>
|
|
309
|
-
<p class="ck-meta-copy">Get, update, or delete a provider credential.</p>
|
|
13
|
+
<%= render CompletionKit.config.api_reference_authentication_partial, token: @token %>
|
|
310
14
|
</div>
|
|
311
15
|
</div>
|
|
312
|
-
|
|
313
16
|
</div>
|
|
314
17
|
</div>
|
|
315
18
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
el.setAttribute('aria-label', showing ? 'Hide API token' : 'Reveal API token');
|
|
322
|
-
navigator.clipboard.writeText(el.dataset.real).then(function() {
|
|
323
|
-
el.classList.add('ck-api-copy--done');
|
|
324
|
-
setTimeout(function() { el.classList.remove('ck-api-copy--done'); }, 1500);
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
function ckCopyExample(btn) {
|
|
329
|
-
var pre = btn.closest('.ck-api-example').querySelector('pre');
|
|
330
|
-
var text = pre.textContent;
|
|
331
|
-
var realToken = btn.dataset.realToken;
|
|
332
|
-
var displayToken = btn.dataset.displayToken;
|
|
333
|
-
if (realToken && displayToken) {
|
|
334
|
-
text = text.split(displayToken).join(realToken);
|
|
335
|
-
}
|
|
336
|
-
navigator.clipboard.writeText(text).then(function() {
|
|
337
|
-
btn.classList.add('ck-api-copy--done');
|
|
338
|
-
setTimeout(function() { btn.classList.remove('ck-api-copy--done'); }, 1500);
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
</script>
|
|
19
|
+
<%= render "completion_kit/api_reference/body",
|
|
20
|
+
base_url: @base_url,
|
|
21
|
+
token: ck_masked_token(@token),
|
|
22
|
+
real_token: @token,
|
|
23
|
+
published_prompts: @published_prompts %>
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
</div>
|
|
11
11
|
<% end %>
|
|
12
12
|
|
|
13
|
+
<% if prompt.persisted? && prompt.runs.exists? %>
|
|
14
|
+
<p class="ck-version-note">Editing <%= prompt.version_label %> — it has runs, so saving creates a new version of this prompt.</p>
|
|
15
|
+
<% end %>
|
|
16
|
+
|
|
13
17
|
<div class="ck-card ck-form-card">
|
|
14
18
|
<div class="ck-field">
|
|
15
19
|
<%= form.label :name, "Name", class: "ck-label" %>
|
|
@@ -33,7 +37,8 @@
|
|
|
33
37
|
<% if available.any? %>
|
|
34
38
|
<div class="ck-select-with-action">
|
|
35
39
|
<%= form.select :llm_model, ck_grouped_models(available, prompt.llm_model), { include_blank: "— Select a model —" }, { class: "ck-input", id: "prompt_llm_model" } %>
|
|
36
|
-
|
|
40
|
+
<% ck_refreshing = CompletionKit::ProviderCredential.discovery_in_progress? %>
|
|
41
|
+
<button type="button" class="ck-icon-btn<%= ' ck-icon-btn--spinning' if ck_refreshing %>" title="Refresh models" <%= 'disabled' if ck_refreshing %> onclick="ckRefreshModels()"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="16" height="16"><path fill-rule="evenodd" d="M13.836 2.477a.75.75 0 0 1 .75.75v3.182a.75.75 0 0 1-.75.75h-3.182a.75.75 0 0 1 0-1.5h1.37l-.84-.841a4.5 4.5 0 0 0-7.08.681.75.75 0 0 1-1.264-.808 6 6 0 0 1 9.44-.908l.84.84V3.227a.75.75 0 0 1 .75-.75Zm-.911 7.5A.75.75 0 0 1 13.199 11a6 6 0 0 1-9.44.908l-.84-.84v1.68a.75.75 0 0 1-1.5 0V9.567a.75.75 0 0 1 .75-.75h3.182a.75.75 0 0 1 0 1.5h-1.37l.84.841a4.5 4.5 0 0 0 7.08-.681.75.75 0 0 1 1.024-.274Z" clip-rule="evenodd"/></svg></button>
|
|
37
42
|
</div>
|
|
38
43
|
<% else %>
|
|
39
44
|
<p class="ck-meta-copy">No models available. <%= link_to "Add a provider", provider_credentials_path, class: "ck-link" %> or click refresh after configuring a provider.</p>
|
|
@@ -30,6 +30,13 @@
|
|
|
30
30
|
<tr onclick="window.location='<%= prompt_path(prompt) %>'" style="cursor: pointer;">
|
|
31
31
|
<td>
|
|
32
32
|
<strong><%= prompt.name %></strong>
|
|
33
|
+
<% if prompt.description.present? %>
|
|
34
|
+
<p class="ck-prompts-table__desc"><%= truncate(prompt.description, length: 120) %></p>
|
|
35
|
+
<% end %>
|
|
36
|
+
<div class="ck-endpoint ck-endpoint--compact" onclick="event.stopPropagation()">
|
|
37
|
+
<code class="ck-endpoint__url" id="prompt_endpoint_<%= prompt.id %>"><%= api_v1_prompt_path(prompt.slug) %></code>
|
|
38
|
+
<button type="button" class="ck-icon-btn" title="Copy API path" onclick="event.stopPropagation();navigator.clipboard.writeText(document.getElementById('prompt_endpoint_<%= prompt.id %>').textContent)"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="13" height="13" aria-hidden="true"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"/><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"/></svg></button>
|
|
39
|
+
</div>
|
|
33
40
|
<% if prompt.tags.any? %>
|
|
34
41
|
<div class="tag-marks-row">
|
|
35
42
|
<%= render "completion_kit/tags/marks", tags: prompt.tags %>
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
<div>
|
|
8
8
|
<div class="ck-inline">
|
|
9
9
|
<h1 class="ck-title"><%= @prompt.name %></h1>
|
|
10
|
+
<span class="ck-chip ck-chip--soft"><%= @prompt.version_label %></span>
|
|
10
11
|
<span class="ck-chip"><%= @prompt.llm_model %></span>
|
|
11
12
|
</div>
|
|
12
13
|
<% if @prompt.description.present? %>
|
|
@@ -47,7 +48,9 @@
|
|
|
47
48
|
<pre class="ck-code ck-code--dark"><%= @prompt.template %></pre>
|
|
48
49
|
</section>
|
|
49
50
|
|
|
50
|
-
<% versions = @prompt.family_versions %>
|
|
51
|
+
<% versions = @prompt.family_versions.includes(runs: { responses: :reviews }).to_a %>
|
|
52
|
+
<% predecessor_of = versions.index_with { |v| versions.detect { |o| o.version_number < v.version_number } } %>
|
|
53
|
+
<% version_changed = ->(v, pred) { pred && (pred.template != v.template || pred.llm_model != v.llm_model) } %>
|
|
51
54
|
<% if versions.size > 1 %>
|
|
52
55
|
<section class="ck-card--spaced">
|
|
53
56
|
<p class="ck-kicker">Versions</p>
|
|
@@ -56,28 +59,82 @@
|
|
|
56
59
|
<tr>
|
|
57
60
|
<th>Version</th>
|
|
58
61
|
<th>Model</th>
|
|
62
|
+
<th>Best score</th>
|
|
59
63
|
<th>Created</th>
|
|
60
|
-
<th></th>
|
|
61
64
|
</tr>
|
|
62
65
|
</thead>
|
|
63
66
|
<tbody>
|
|
64
67
|
<% versions.each do |v| %>
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
<% best_score = v.runs.map(&:avg_score).compact.max %>
|
|
69
|
+
<% pred = predecessor_of[v] %>
|
|
70
|
+
<tr class="<%= "ck-results-table__row--active" if v.id == @prompt.id %>" onclick="window.location='<%= prompt_path(v) %>'" style="cursor: pointer;">
|
|
71
|
+
<td>
|
|
72
|
+
<div class="ck-version-cell">
|
|
73
|
+
<div class="ck-version-cell__label" onclick="event.stopPropagation()">
|
|
74
|
+
<strong>v<%= v.version_number %></strong>
|
|
75
|
+
<% if v.current? %>
|
|
76
|
+
<span class="ck-chip">Published</span>
|
|
77
|
+
<% else %>
|
|
78
|
+
<%= button_to "Publish", publish_prompt_path(v), method: :post, class: "ck-chip ck-chip--publish", form_class: "inline-block" %>
|
|
79
|
+
<% end %>
|
|
80
|
+
</div>
|
|
81
|
+
<% if version_changed.call(v, pred) %>
|
|
82
|
+
<button type="button" class="ck-cell-link ck-cell-link--delta" title="What changed from v<%= pred.version_number %>" onclick="event.stopPropagation();document.getElementById('ck-vdiff-<%= v.id %>').showModal()">Δ</button>
|
|
83
|
+
<% end %>
|
|
84
|
+
</div>
|
|
85
|
+
</td>
|
|
67
86
|
<td><span class="ck-chip ck-chip--soft"><%= v.llm_model %></span></td>
|
|
68
|
-
<td class="ck-meta-copy"><time datetime="<%= v.created_at.iso8601 %>" data-local-time><%= v.created_at.utc.strftime("%b %-d, %Y at %-I:%M %p UTC") %></time></td>
|
|
69
87
|
<td>
|
|
70
|
-
<% if
|
|
71
|
-
<span class="
|
|
88
|
+
<% if best_score %>
|
|
89
|
+
<span class="<%= ck_badge_classes(ck_score_kind(best_score)) %>"><%= best_score %></span>
|
|
72
90
|
<% else %>
|
|
73
|
-
|
|
91
|
+
<span class="ck-prompts-table__dim">—</span>
|
|
74
92
|
<% end %>
|
|
75
93
|
</td>
|
|
94
|
+
<td class="ck-meta-copy"><time datetime="<%= v.created_at.iso8601 %>" data-local-time><%= v.created_at.utc.strftime("%b %-d, %Y at %-I:%M %p UTC") %></time></td>
|
|
76
95
|
</tr>
|
|
77
96
|
<% end %>
|
|
78
97
|
</tbody>
|
|
79
98
|
</table>
|
|
80
99
|
</section>
|
|
100
|
+
|
|
101
|
+
<% versions.each do |v| %>
|
|
102
|
+
<% pred = predecessor_of[v] %>
|
|
103
|
+
<% next unless version_changed.call(v, pred) %>
|
|
104
|
+
<dialog id="ck-vdiff-<%= v.id %>" class="ck-modal" onclick="if(event.target===this)this.close()">
|
|
105
|
+
<article class="ck-modal__panel" tabindex="-1" autofocus onclick="event.stopPropagation()">
|
|
106
|
+
<header class="ck-modal__header">
|
|
107
|
+
<div class="ck-modal__heading">
|
|
108
|
+
<h2 class="ck-modal__title">v<%= pred.version_number %> → v<%= v.version_number %></h2>
|
|
109
|
+
<span class="ck-modal__meta">What changed in <%= v.version_label %><% if v.current? %> (published)<% end %></span>
|
|
110
|
+
</div>
|
|
111
|
+
<button type="button" class="ck-modal__close" aria-label="Close" onclick="this.closest('dialog').close()">×</button>
|
|
112
|
+
</header>
|
|
113
|
+
<div class="ck-modal__body">
|
|
114
|
+
<% if pred.llm_model != v.llm_model %>
|
|
115
|
+
<p class="ck-version-change">
|
|
116
|
+
<span class="ck-version-change__label">Model</span>
|
|
117
|
+
<span class="ck-version-change__old"><%= pred.llm_model %></span>
|
|
118
|
+
<span class="ck-version-change__arrow" aria-hidden="true">→</span>
|
|
119
|
+
<span class="ck-version-change__new"><%= v.llm_model %></span>
|
|
120
|
+
</p>
|
|
121
|
+
<% end %>
|
|
122
|
+
<% if pred.template != v.template %>
|
|
123
|
+
<div class="ck-suggest-diff">
|
|
124
|
+
<div class="ck-suggest-diff__pane">
|
|
125
|
+
<div class="ck-suggest-diff__header"><span class="ck-suggest-diff__label ck-suggest-diff__label--before"><%= pred.version_label %></span></div>
|
|
126
|
+
<pre class="ck-suggest-diff__code"><%= ck_word_diff_old(pred.template, v.template) %></pre>
|
|
127
|
+
</div>
|
|
128
|
+
<div class="ck-suggest-diff__pane">
|
|
129
|
+
<div class="ck-suggest-diff__header"><span class="ck-suggest-diff__label ck-suggest-diff__label--after"><%= v.version_label %></span></div>
|
|
130
|
+
<pre class="ck-suggest-diff__code"><%= ck_word_diff_new(pred.template, v.template) %></pre>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
<% end %>
|
|
134
|
+
</div>
|
|
135
|
+
</article>
|
|
136
|
+
</dialog>
|
|
137
|
+
<% end %>
|
|
81
138
|
<% end %>
|
|
82
139
|
|
|
83
140
|
<% if @runs.any? %>
|
|
@@ -41,26 +41,31 @@
|
|
|
41
41
|
</tr>
|
|
42
42
|
</thead>
|
|
43
43
|
<tbody>
|
|
44
|
-
<% models.each do |
|
|
45
|
-
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
44
|
+
<% ck_model_table_sections(models).each do |section_label, section_models| %>
|
|
45
|
+
<% if section_label %>
|
|
46
|
+
<tr class="ck-model-table__section"><td colspan="3"><%= section_label %></td></tr>
|
|
47
|
+
<% end %>
|
|
48
|
+
<% section_models.each do |m| %>
|
|
49
|
+
<tr>
|
|
50
|
+
<td class="ck-model-table__name"><%= m.display_name || m.model_id %></td>
|
|
51
|
+
<td class="ck-model-table__cap">
|
|
52
|
+
<% if m.supports_generation %>
|
|
53
|
+
<span class="ck-model-table__tick" aria-label="Supports generation">✓</span>
|
|
54
|
+
<% else %>
|
|
55
|
+
<span class="ck-model-table__dash" aria-label="No generation support">—</span>
|
|
56
|
+
<% end %>
|
|
57
|
+
</td>
|
|
58
|
+
<td class="ck-model-table__cap">
|
|
59
|
+
<% if m.supports_judging %>
|
|
60
|
+
<span class="ck-model-table__tick" aria-label="Supports judging">✓</span>
|
|
61
|
+
<% elsif m.supports_judging.nil? %>
|
|
62
|
+
<span class="ck-model-table__unknown" aria-label="Untested as judge" title="Untested as a judge — selectable; a successful run confirms it">?</span>
|
|
63
|
+
<% else %>
|
|
64
|
+
<span class="ck-model-table__dash" aria-label="Not usable as judge">—</span>
|
|
65
|
+
<% end %>
|
|
66
|
+
</td>
|
|
67
|
+
</tr>
|
|
68
|
+
<% end %>
|
|
64
69
|
<% end %>
|
|
65
70
|
</tbody>
|
|
66
71
|
</table>
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
<div class="ck-provider-card__meta">
|
|
29
29
|
<span><%= provider_credential.api_endpoint.presence || default_endpoints[provider_credential.provider] %></span>
|
|
30
|
+
<span><%= provider_credential.model_count %> models</span>
|
|
30
31
|
<span><%= provider_credential.prompt_count %> prompts</span>
|
|
31
32
|
<span><%= provider_credential.judge_count %> judges</span>
|
|
32
33
|
<span><% if provider_credential.last_used_at %>Used <time data-relative-time datetime="<%= provider_credential.last_used_at.utc.iso8601 %>"><%= time_ago_in_words(provider_credential.last_used_at) %></time> ago<% else %>Never used<% end %></span>
|
|
@@ -74,7 +74,8 @@
|
|
|
74
74
|
<% if available.any? %>
|
|
75
75
|
<div class="ck-select-with-action">
|
|
76
76
|
<%= form.select :judge_model, ck_grouped_models(available, run.judge_model), { include_blank: "None" }, { class: "ck-input", id: "run_judge_model" } %>
|
|
77
|
-
|
|
77
|
+
<% ck_refreshing = CompletionKit::ProviderCredential.discovery_in_progress? %>
|
|
78
|
+
<button type="button" class="ck-icon-btn<%= ' ck-icon-btn--spinning' if ck_refreshing %>" title="Refresh models" <%= 'disabled' if ck_refreshing %> onclick="ckRefreshModels()"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="16" height="16"><path fill-rule="evenodd" d="M13.836 2.477a.75.75 0 0 1 .75.75v3.182a.75.75 0 0 1-.75.75h-3.182a.75.75 0 0 1 0-1.5h1.37l-.84-.841a4.5 4.5 0 0 0-7.08.681.75.75 0 0 1-1.264-.808 6 6 0 0 1 9.44-.908l.84.84V3.227a.75.75 0 0 1 .75-.75Zm-.911 7.5A.75.75 0 0 1 13.199 11a6 6 0 0 1-9.44.908l-.84-.84v1.68a.75.75 0 0 1-1.5 0V9.567a.75.75 0 0 1 .75-.75h3.182a.75.75 0 0 1 0 1.5h-1.37l.84.841a4.5 4.5 0 0 0 7.08-.681.75.75 0 0 1 1.024-.274Z" clip-rule="evenodd"/></svg></button>
|
|
78
79
|
</div>
|
|
79
80
|
<p class="ck-field-hint" id="judge-hint"></p>
|
|
80
81
|
<div hidden data-refresh-progress-carriers>
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
|
|
81
81
|
<% if @run.dataset %>
|
|
82
82
|
<dialog id="dataset-preview-<%= @run.id %>" class="ck-modal" onclick="if(event.target===this)this.close()">
|
|
83
|
-
<article class="ck-modal__panel" onclick="event.stopPropagation()">
|
|
83
|
+
<article class="ck-modal__panel" tabindex="-1" autofocus onclick="event.stopPropagation()">
|
|
84
84
|
<header class="ck-modal__header">
|
|
85
85
|
<div class="ck-modal__heading">
|
|
86
86
|
<h2 class="ck-modal__title"><%= @run.dataset.name %></h2>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<% label_text = local_assigns[:label].presence || "#{param_namespace.to_s.titleize} tags" %>
|
|
3
3
|
<%= label_tag "#{param_namespace}_tags", label_text, class: "ck-label" %>
|
|
4
4
|
<% all_tags = CompletionKit::Tag.order(:name) %>
|
|
5
|
-
<% selected_ids = record.persisted? ? record.tags.
|
|
5
|
+
<% selected_ids = (record.persisted? || record.tags.loaded?) ? record.tags.map(&:id) : [] %>
|
|
6
6
|
<div class="ck-tag-picker">
|
|
7
7
|
<% all_tags.each do |tag| %>
|
|
8
8
|
<% checked = selected_ids.include?(tag.id) %>
|
|
@@ -45,8 +45,9 @@
|
|
|
45
45
|
<main class="ck-main">
|
|
46
46
|
<div class="ck-wrap">
|
|
47
47
|
<% flash.each do |type, message| %>
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
<% notice = type.to_s == "notice" %>
|
|
49
|
+
<div class="ck-flash <%= notice ? "ck-flash--notice" : "ck-flash--alert" %>" role="<%= notice ? "status" : "alert" %>">
|
|
50
|
+
<span class="ck-flash__label"><%= notice ? "Notice" : "Alert" %></span><span class="ck-flash__body"><%= message %></span>
|
|
50
51
|
</div>
|
|
51
52
|
<% end %>
|
|
52
53
|
|