Flow Tester AI 프롬프트 템플릿 개선
- config.apiKey 필드를 JSON에서 제거 (서버 자동 주입) - config.baseUrl을 빈 문자열로 설정 (서버 기본값 사용) - 프롬프트 템플릿에 더 명확한 규칙 추가 - 로그인 스텝 포함한 완전한 예시 제공 - 예시 프롬프트 간소화
This commit is contained in:
@@ -168,33 +168,44 @@ public function validateJson(Request $request)
|
||||
]);
|
||||
}
|
||||
|
||||
// meta 정보 추출
|
||||
// meta 정보 추출 (최상위 또는 meta 객체에서)
|
||||
$meta = $data['meta'] ?? [];
|
||||
$tags = $meta['tags'] ?? [];
|
||||
|
||||
// 카테고리 추론: tags[0] 또는 첫 번째 endpoint에서 추출
|
||||
$category = $tags[0] ?? null;
|
||||
// 카테고리 추론: 최상위 category > tags[0] > endpoint에서 추출 (login 제외)
|
||||
$category = $data['category'] ?? $tags[0] ?? null;
|
||||
if (! $category && ! empty($data['steps'])) {
|
||||
$firstEndpoint = $data['steps'][0]['endpoint'] ?? '';
|
||||
// /item-master/pages → item-master
|
||||
if (preg_match('#^/([^/]+)#', $firstEndpoint, $matches)) {
|
||||
$category = $matches[1];
|
||||
// login, auth, refresh, logout 등 인증 관련 엔드포인트는 건너뛰고 추출
|
||||
$authEndpoints = ['/login', '/logout', '/refresh', '/auth'];
|
||||
foreach ($data['steps'] as $step) {
|
||||
$endpoint = $step['endpoint'] ?? '';
|
||||
// 인증 엔드포인트가 아닌 첫 번째 스텝에서 카테고리 추출
|
||||
if (! in_array($endpoint, $authEndpoints) && preg_match('#^/([^/]+)#', $endpoint, $matches)) {
|
||||
$category = $matches[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 이름 추론: meta.name 또는 description 첫 부분
|
||||
$name = $meta['name'] ?? null;
|
||||
if (! $name && ! empty($meta['description'])) {
|
||||
// 설명의 첫 번째 줄 또는 50자까지
|
||||
$name = mb_substr(strtok($meta['description'], "\n"), 0, 50);
|
||||
// 이름 추론: 최상위 name > meta.name > description 첫 부분
|
||||
$name = $data['name'] ?? $meta['name'] ?? null;
|
||||
if (! $name) {
|
||||
$description = $data['description'] ?? $meta['description'] ?? null;
|
||||
if ($description) {
|
||||
// 설명의 첫 번째 줄 또는 50자까지
|
||||
$name = mb_substr(strtok($description, "\n"), 0, 50);
|
||||
}
|
||||
}
|
||||
|
||||
// 설명 추론: 최상위 description > meta.description
|
||||
$description = $data['description'] ?? $meta['description'] ?? null;
|
||||
|
||||
return response()->json([
|
||||
'valid' => true,
|
||||
'stepCount' => count($data['steps'] ?? []),
|
||||
'extracted' => [
|
||||
'name' => $name,
|
||||
'description' => $meta['description'] ?? null,
|
||||
'description' => $description,
|
||||
'category' => $category,
|
||||
'author' => $meta['author'] ?? null,
|
||||
'tags' => $tags,
|
||||
|
||||
Reference in New Issue
Block a user