forked from hangshuo652/aurak
fix: linkedGroupIds null check in validateRequiredFields
null !== undefined was true, causing false validation failure on templates without linked groups. Changed to != null check.
This commit is contained in:
@@ -77,14 +77,13 @@ export const interviewerNode = async (
|
||||
? `質問 ${currentQuestionIndex + 1}`
|
||||
: `Question ${currentQuestionIndex + 1}`;
|
||||
|
||||
const optionsText = currentQuestion.options.join('\n');
|
||||
const instruction = isZh
|
||||
? '请选择一个选项(输入字母 A/B/C/D)'
|
||||
? '请选择一个选项'
|
||||
: isJa
|
||||
? '選択肢から1つ選んでください(A/B/C/Dを入力)'
|
||||
: 'Please select one option (enter A, B, C, or D)';
|
||||
? '選択肢から1つ選んでください'
|
||||
: 'Please select one option';
|
||||
|
||||
prompt = `${label}: ${currentQuestion.questionText}\n\n${optionsText}\n\n${instruction}`;
|
||||
prompt = `${label}: ${currentQuestion.questionText}\n\n${instruction}`;
|
||||
} else {
|
||||
const label = isZh
|
||||
? `问题 ${currentQuestionIndex + 1}`
|
||||
|
||||
@@ -20,16 +20,16 @@ export class TemplateService {
|
||||
) {}
|
||||
|
||||
private validateRequiredFields(data: {
|
||||
linkedGroupIds?: string[];
|
||||
dimensions?: Array<{ name: string; label?: string; weight?: number }>;
|
||||
linkedGroupIds?: string[] | null;
|
||||
dimensions?: Array<{ name: string; label?: string; weight?: number }> | null;
|
||||
}) {
|
||||
if (data.linkedGroupIds !== undefined) {
|
||||
if (!Array.isArray(data.linkedGroupIds) || data.linkedGroupIds.length === 0) {
|
||||
if (data.linkedGroupIds != null && Array.isArray(data.linkedGroupIds)) {
|
||||
if (data.linkedGroupIds.length === 0) {
|
||||
throw new BadRequestException('At least one knowledge group must be linked');
|
||||
}
|
||||
}
|
||||
if (data.dimensions !== undefined) {
|
||||
if (!Array.isArray(data.dimensions) || data.dimensions.length === 0) {
|
||||
if (data.dimensions != null && Array.isArray(data.dimensions)) {
|
||||
if (data.dimensions.length === 0) {
|
||||
throw new BadRequestException('At least one dimension must be defined');
|
||||
}
|
||||
for (const d of data.dimensions) {
|
||||
|
||||
Reference in New Issue
Block a user