<!DOCTYPE html>
<html lang="en" class="h-full bg-gray-100">

<head>
  <meta charset="UTF-8">
  <title>水群助手</title>

  <link href="assets/css/daisyui-4.4.14-full.min.css" rel="stylesheet" type="text/css"/>
  <link href="assets/css/index.css" rel="stylesheet" type="text/css"/>

  <script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio,line-clamp"></script>
  <script src="https://cdn.bootcdn.net/ajax/libs/axios/1.5.0/axios.min.js"></script>

  <script src="assets/js/index.js"></script>
</head>

<body class="h-full">
<div class="min-h-full">
  {{ template "head.html" "assistant" }}

  <main class="-mt-32">
    <div class="mx-auto max-w-7xl px-4 pb-12 sm:px-6 lg:px-8">
      <div class="rounded-lg bg-white px-5 py-6 shadow sm:px-6 text-2xl">
        <ul role="list" class="grid grid-cols-1 gap-x-6 gap-y-8 lg:grid-cols-2 xl:gap-x-8">
          {{ range .assistant }}
          <li class="overflow-hidden rounded-xl border border-gray-200">
            <!-- 头 -->
<!--            <div class="flex items -center gap-x-4 border-b border-gray-900/5 bg-gray-50 p-6">-->
<!--              <div class="text-sm flex-1">-->
<!--                <div class="font-medium leading-6 text-gray-900">{{ .Name }}</div>-->
<!--                <div class="font-medium text-gray-500">{{ .CreatedAt }}</div>-->
<!--              </div>-->
<!--            </div>-->

            <!-- body -->
            <form action="/api/assistant" method="post">
              <div class="-my-3 divide-y divide-gray-100 px-6 py-4 text-sm leading-6">
                <div class="border-b border-gray-900/10 pb-12">
                  <div class="mt-10 grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6">
                    <div class="sm:col-span-4">
                      <label for="name-{{.Id}}" class="block text-sm font-medium leading-6 text-gray-900">角色名称</label>
                      <div class="mt-2">
                        <div class="flex rounded-md shadow-sm ring-1 ring-inset ring-gray-300 focus-within:ring-2 focus-within:ring-inset focus-within:ring-indigo-600 sm:max-w-md">
                          <input type="text" value="{{.Name}}" name="name" id="name-{{.Id}}" class="block flex-1 border-0 bg-transparent py-1.5 pl-1 text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm sm:leading-6" placeholder="请输入角色名称">
                        </div>
                      </div>
                    </div>

                    <div class="col-span-full">
                      <label for="about-{{.Id}}" class="block text-sm font-medium leading-6 text-gray-900">Prompt</label>
                      <div class="mt-2">
                        <textarea id="about-{{.Id}}" name="about" rows="4" class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" placeholder="请输入角色Prompt">{{.Personality}}</textarea>
                      </div>
                    </div>

                    <div class="col-span-full">
                      <label for="model-{{.Id}}" class="block text-sm font-medium leading-6 text-gray-900">AI模型</label>
                      <div class="mt-2">
                        <select id="model-{{.Id}}" class="block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-green-600 sm:text-sm sm:leading-6">
                          {{$useModel := .Model}}
                          {{ range $.aiModels }}
                          <option value="{{.Model}}" {{ if eq $useModel .Model}}selected{{ end }}>
                            {{.Name}}
                          </option>
                          {{ end }}
                        </select>
                      </div>
                    </div>
                  </div>
                </div>
              </div>

              <div class="mt-6 flex items-center justify-end gap-x-6">
                <button type="submit" class="rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600">Save</button>
              </div>
            </form>
          </li>
          {{ end }}
        </ul>
      </div>
    </div>
  </main>

  {{ template "footer.html" }}

  {{ template "groupuser.html" }}
</div>

</body>