-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #860 from dimagi/sk/llm-provider-updates
LLM Provider updates
- Loading branch information
Showing
13 changed files
with
207 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from django import template | ||
|
||
register = template.Library() | ||
|
||
|
||
@register.simple_tag | ||
def define(val=None): | ||
return val | ||
|
||
|
||
@register.filter(name="times") | ||
def times(number): | ||
return range(number) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<div class="dropdown dropdown-right"> | ||
<div tabindex="0" role="button" class="btn btn-circle btn-ghost btn-xs text-info"> | ||
<svg | ||
tabindex="0" | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
class="h-4 w-4 stroke-current"> | ||
<path | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
stroke-width="2" | ||
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path> | ||
</svg> | ||
</div> | ||
<div | ||
tabindex="0" | ||
class="card compact dropdown-content bg-base-100 rounded-box z-[1] w-64 shadow"> | ||
<div tabindex="0" class="card-body"> | ||
{% if help_title %}<h2 class="card-title">{{ help_title }}</h2>{% endif %} | ||
<p>{{ help_content }}</p> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
templates/service_providers/components/custom_llm_models.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{% if not models_by_type %} | ||
<p>No custom models</p> | ||
{% else %} | ||
{% include "service_providers/components/llm_models.html" with models_by_type=models_by_type show_delete=True %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{% define 2 as num_cols %} | ||
{% for type_, models in models_by_type.items %} | ||
<div id="models_{{ type_ }}" x-show="type === '{{ type_ }}'" class="mt-2" | ||
{% if not for_type or type_ != for_type %}style="display:none"{% endif %} | ||
> | ||
<div class="grid grid-cols-{{ num_cols }} gap-x-5"> | ||
{% for i in num_cols|times %} | ||
<div class="grid grid-cols-3 font-semibold"> | ||
<div>Model Name</div> | ||
<div class="place-self-center">Token Limit</div> | ||
{% if show_delete %} | ||
<div class="place-self-start">Delete</div> | ||
{% endif %} | ||
</div> | ||
{% endfor %} | ||
{% for model in models %} | ||
<div class="grid grid-cols-3" id="model_{{ model.id }}"> | ||
<div>{{ model.name }}</div> | ||
<div class="place-self-center">{{ model.max_token_limit }}</div> | ||
{% if show_delete %} | ||
<div class="place-self-start"> | ||
<button class="btn btn-xs btn-ghost" | ||
hx-delete="{% url "service_providers:llm_provider_model_delete" request.team.slug model.id%}" | ||
hx-target="#model_{{ model.id }}" | ||
hx-swap="outerHTML"> | ||
<i class="fa-solid fa-trash"></i> | ||
</button> | ||
</div> | ||
{% endif %} | ||
</div> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
{% endfor %} |
Oops, something went wrong.