Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion runner/ratings/built-in-ratings/valid-css-rating.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const validCssRating: PerFileRating = {
kind: RatingKind.PER_FILE,
id: 'common-valid-css',
filter: PerFileRatingContentType.CSS,
rate: async (code, _filePath) => {
rate: async (code) => {
const linterResult = await stylelint.lint({
code: code,
cwd: import.meta.dirname,
Expand Down
40 changes: 20 additions & 20 deletions runner/ratings/rate-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,19 @@ export async function rateGeneratedCode(
for (const current of currentPromptDef.ratings) {
let result: IndividualAssessment | SkippedIndividualAssessment;

if (current.kind === RatingKind.PER_BUILD) {
result = runPerBuildRating(
current,
buildResult,
repairAttempts,
outputFiles.length,
axeRepairAttempts
);
} else if (current.kind === RatingKind.PER_FILE) {
categorizedFiles ??= splitFilesIntoCategories(outputFiles);
result = await runPerFileRating(current, categorizedFiles);
} else if (current.kind === RatingKind.LLM_BASED) {
try {
try {
if (current.kind === RatingKind.PER_BUILD) {
result = runPerBuildRating(
current,
buildResult,
repairAttempts,
outputFiles.length,
axeRepairAttempts
);
} else if (current.kind === RatingKind.PER_FILE) {
categorizedFiles ??= splitFilesIntoCategories(outputFiles);
result = await runPerFileRating(current, categorizedFiles);
} else if (current.kind === RatingKind.LLM_BASED) {
result = await runLlmBasedRating(
environment,
current,
Expand All @@ -109,14 +109,14 @@ export async function rateGeneratedCode(
axeRepairAttempts,
abortSignal
);
} catch (error) {
result = getSkippedAssessment(
current,
`Error during execution:\n${error}`
);
} else {
throw new UserFacingError(`Unsupported rating type ${current}`);
}
} else {
throw new UserFacingError(`Unsupported rating type ${current}`);
} catch (error) {
result = getSkippedAssessment(
current,
`Error during execution:\n${error}`
);
}

if (result.state === IndividualAssessmentState.EXECUTED && result.usage) {
Expand Down
Loading