Introduced an “Inference Tokens” page to manage tokens for inference endpoints. Users can create and delete tokens directly from this interface. The tokens are required to send requests to into inference endpoints. Requests are billed to the project the token belongs to.
48 lines
2.2 KiB
Text
48 lines
2.2 KiB
Text
<% @page_title = "Inference Tokens" %>
|
|
<%== render("inference/tabbar") %>
|
|
|
|
<div>
|
|
<% unless @inference_tokens.empty? %>
|
|
<div class="overflow-hidden rounded-lg shadow ring-1 ring-black ring-opacity-5 bg-white divide-y divide-gray-200">
|
|
<table class="min-w-full divide-y divide-gray-300">
|
|
<thead class="bg-gray-50">
|
|
<tr>
|
|
<th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">ID</th>
|
|
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Token</th>
|
|
<th scope="col" class="py-3.5 pl-3 pr-4 sm:pr-6 text-left text-sm font-semibold text-gray-900"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-200 bg-white">
|
|
<% @inference_tokens.each do |token| %>
|
|
<tr id="token-<%= token[:id] %>">
|
|
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6" scope="row">
|
|
<%= token[:id] %>
|
|
</td>
|
|
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
|
|
<%== render("components/revealable_content", locals: { content: token[:key] }) %>
|
|
</td>
|
|
<td class="py-4 pl-3 pr-4 text-right sm:pr-6">
|
|
<%== has_project_permission("InferenceToken:delete") ? render(
|
|
"components/delete_button",
|
|
locals: {
|
|
text: "Delete",
|
|
url: "#{@project_data[:path]}/inference-token/#{token[:id]}",
|
|
confirmation: "delete token"
|
|
}
|
|
) : "No Permission to delete" %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<% end %>
|
|
<% if has_project_permission("InferenceToken:create") && @inference_tokens.size < 10 %>
|
|
<div class="flex justify-end space-y-1 mt-6">
|
|
<form id="create-inference-token" action="<%= "#{@project_data[:path]}/inference-token" %>" role="form" method="POST">
|
|
<%== csrf_tag("#{@project_data[:path]}/inference-token") %>
|
|
<%== render("components/form/submit_button", locals: { text: "Create Token" }) %>
|
|
</form>
|
|
</div>
|
|
<% end %>
|
|
</div>
|