Flow Tester AI 프롬프트 템플릿 개선

- config.apiKey 필드를 JSON에서 제거 (서버 자동 주입)
- config.baseUrl을 빈 문자열로 설정 (서버 기본값 사용)
- 프롬프트 템플릿에 더 명확한 규칙 추가
- 로그인 스텝 포함한 완전한 예시 제공
- 예시 프롬프트 간소화
This commit is contained in:
2025-12-05 14:19:59 +09:00
parent 5c892c1ed9
commit 858ce6194d
6 changed files with 150 additions and 75 deletions

View File

@@ -82,15 +82,28 @@ public function getUserById(int $id): ?User
}
/**
* 사용자 생성 (관리자용: 임의 비밀번호 생성 + 메일 발송)
* 사용자 생성
* - 본사(HQ): 임의 비밀번호 생성 + 메일 발송
* - 비본사: 입력된 비밀번호 사용 (메일 발송 안 함)
*/
public function createUser(array $data): User
{
$tenantId = session('selected_tenant_id');
// 임의 비밀번호 생성 (8자리 영문+숫자)
$plainPassword = $this->generateRandomPassword();
$data['password'] = Hash::make($plainPassword);
// 비밀번호 처리: 입력된 비밀번호가 있으면 사용, 없으면 자동 생성
$passwordProvided = ! empty($data['password']);
if ($passwordProvided) {
// 비본사: 입력된 비밀번호 사용
$data['password'] = Hash::make($data['password']);
$plainPassword = null; // 메일 발송하지 않음
} else {
// 본사: 임의 비밀번호 생성 (8자리 영문+숫자)
$plainPassword = $this->generateRandomPassword();
$data['password'] = Hash::make($plainPassword);
}
// password_confirmation은 User 모델의 fillable이 아니므로 제거
unset($data['password_confirmation']);
// is_active 처리
$data['is_active'] = isset($data['is_active']) && $data['is_active'] == '1';
@@ -120,8 +133,10 @@ public function createUser(array $data): User
$this->syncDepartments($user, $tenantId, $departmentIds);
}
// 비밀번호 안내 메일 발송
$this->sendPasswordMail($user, $plainPassword, true);
// 본사만 비밀번호 안내 메일 발송 (비본사는 관리자가 직접 알려줌)
if ($plainPassword !== null) {
$this->sendPasswordMail($user, $plainPassword, true);
}
return $user;
}