<ion-header [translucent]="true">
  <ion-toolbar>
    <ion-buttons slot="start">
      <ion-button (click)="backhome()" color="primary" >{{back}}</ion-button>
    </ion-buttons>
    <ion-title>创建智能体</ion-title>
    <!-- <ion-progress-bar type="indeterminate"></ion-progress-bar> -->
  </ion-toolbar>
</ion-header>


<ion-content [fullscreen]="true">
  <div style="text-align: center; margin-top: 20px">
    <img height="80px" [src]="currentUser.get('avatar')" alt="" style="border-radius: 50%;">
    <p>AI生成头像</p>
  </div>
  <div>
    <ion-card>
      <ion-list>
        <ion-item>
          <p style="width: 60px; font-weight: bolder;">名称：</p>
          <!-- <ion-input label="输入你想了解的科普信息" placeholder="Enter text"></ion-input> -->
          <ion-input  [value]="name" placeholder="输入名称" (ionInput)="nameInput($event)"></ion-input>
        </ion-item>
        <ion-item>
          <p style="width: 60px; font-weight: bolder;">年龄：</p>
          <ion-input  [value]="age" placeholder="输入年龄" (ionInput)="ageInput($event)"></ion-input>
        </ion-item>
        <ion-item>
          <p style="width: 60px;  font-weight: bolder;">性别：</p>
          <ion-select
            aria-label="性别"
            placeholder="选择性别"
            (ionChange)="genderChange($event)"
            (ionCancel)="genderCancel()"
            (ionDismiss)="genderDismiss()"
          >
            <ion-select-option value="男">男</ion-select-option>
            <ion-select-option value="女">女</ion-select-option>
          </ion-select>
        </ion-item>
        <ion-item style="height: auto;">
            <p style="width:120px;font-weight: bolder;">设定描述：</p>
            <ion-textarea [value]="desc" placeholder="示例：你是一位经验丰富的妇科医生，拥有丰富的临床经验" (ionInput)="descInput($event)" autoGrow="true"></ion-textarea> 
        </ion-item>
      </ion-list>
    </ion-card>
  </div>
  <ion-button (click)="createAgent()" expand="block" color="primary" >创建ai医生</ion-button>
  <ion-card>
    <ion-card-header>
      <ion-card-title>我的智能体</ion-card-title>
      <ion-card-subtitle>智能体</ion-card-subtitle>
    </ion-card-header>
    <ion-card-content>
      <ion-list>
        <ion-item (click)="openInquiry(agent)" *ngFor="let agent of agentList" lines="none">
          <ion-thumbnail slot="start">
            <img [src]="agent.get('avatar') || '../../assets/image/doctor7.png'" [alt]="agent.get('name')" />
          </ion-thumbnail>
          <div class="doctor-info">
            <div>
              <ion-text>{{ agent.get('name') }}({{ agent.get('age') }}岁)</ion-text>
            </div>
            <div>
              <ion-text>{{ agent.get('gender') }}</ion-text>
            </div>
          </div>
          <ion-button ios="logo-apple" size="small" color="Danger" (click)="deleteAgent(agent)" slot="end">删除</ion-button>
        </ion-item>
      </ion-list>
    </ion-card-content>
  </ion-card>

</ion-content>