llm-testrunner-components 1.0.6 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -100
- package/dist/cjs/app-chips_5.cjs.entry.js +158 -0
- package/dist/cjs/app-chips_5.cjs.entry.js.map +1 -0
- package/dist/cjs/app-globals-Chb-oJtg.js +34 -0
- package/dist/cjs/app-globals-Chb-oJtg.js.map +1 -0
- package/dist/cjs/index-By1scwl6.js +25542 -0
- package/dist/cjs/index-By1scwl6.js.map +1 -0
- package/dist/cjs/index-CgmLNwZO.js +21460 -0
- package/dist/cjs/index-CgmLNwZO.js.map +1 -0
- package/dist/cjs/index.cjs.js +5 -483
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/llm-testrunner.cjs.js +6 -4
- package/dist/cjs/llm-testrunner.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +5 -3
- package/dist/collection/collection-manifest.json +8 -3
- package/dist/collection/components/error-message/error-message.css +34 -0
- package/dist/collection/components/error-message/error-message.js +2 -2
- package/dist/collection/components/error-message/error-message.js.map +1 -1
- package/dist/collection/components/llm-test-runner/header/llm-test-runner-header.css +60 -0
- package/dist/collection/components/llm-test-runner/header/llm-test-runner-header.js +18 -0
- package/dist/collection/components/llm-test-runner/header/llm-test-runner-header.js.map +1 -0
- package/dist/collection/components/llm-test-runner/llm-test-runner.css +17 -657
- package/dist/collection/components/llm-test-runner/llm-test-runner.import-export.test.js +253 -0
- package/dist/collection/components/llm-test-runner/llm-test-runner.import-export.test.js.map +1 -0
- package/dist/collection/components/llm-test-runner/llm-test-runner.js +191 -200
- package/dist/collection/components/llm-test-runner/llm-test-runner.js.map +1 -1
- package/dist/collection/components/llm-test-runner/test-cases/actions/row-actions.css +28 -0
- package/dist/collection/components/llm-test-runner/test-cases/actions/row-actions.js +6 -0
- package/dist/collection/components/llm-test-runner/test-cases/actions/row-actions.js.map +1 -0
- package/dist/collection/components/llm-test-runner/test-cases/evaluation/evaluation-summary.css +67 -0
- package/dist/collection/components/llm-test-runner/test-cases/evaluation/evaluation-summary.js +5 -0
- package/dist/collection/components/llm-test-runner/test-cases/evaluation/evaluation-summary.js.map +1 -0
- package/dist/collection/components/llm-test-runner/test-cases/llm-test-case-row.css +42 -0
- package/dist/collection/components/llm-test-runner/test-cases/llm-test-case-row.js +39 -0
- package/dist/collection/components/llm-test-runner/test-cases/llm-test-case-row.js.map +1 -0
- package/dist/collection/components/llm-test-runner/test-cases/llm-test-cases.css +39 -0
- package/dist/collection/components/llm-test-runner/test-cases/llm-test-cases.js +7 -0
- package/dist/collection/components/llm-test-runner/test-cases/llm-test-cases.js.map +1 -0
- package/dist/collection/components/llm-test-runner/test-cases/output/response-output.css +51 -0
- package/dist/collection/components/llm-test-runner/test-cases/output/response-output.js +5 -0
- package/dist/collection/components/llm-test-runner/test-cases/output/response-output.js.map +1 -0
- package/dist/collection/global/env.js +3 -1
- package/dist/collection/global/env.js.map +1 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/lib/evaluation/constants.js +14 -0
- package/dist/collection/lib/evaluation/constants.js.map +1 -0
- package/dist/collection/lib/evaluation/evaluation-engine.js +45 -45
- package/dist/collection/lib/evaluation/evaluation-engine.js.map +1 -1
- package/dist/collection/lib/evaluation/evaluation-service.js +33 -0
- package/dist/collection/lib/evaluation/evaluation-service.js.map +1 -0
- package/dist/collection/lib/evaluation/evaluators/bleu/bleu-evaluator.js +116 -0
- package/dist/collection/lib/evaluation/evaluators/bleu/bleu-evaluator.js.map +1 -0
- package/dist/collection/lib/evaluation/evaluators/bleu/tests/bleu.test.js +352 -0
- package/dist/collection/lib/evaluation/evaluators/bleu/tests/bleu.test.js.map +1 -0
- package/dist/collection/lib/evaluation/evaluators/exact/exact.js +44 -0
- package/dist/collection/lib/evaluation/evaluators/exact/exact.js.map +1 -0
- package/dist/collection/lib/evaluation/evaluators/rouge1-evaluator.js +88 -0
- package/dist/collection/lib/evaluation/evaluators/rouge1-evaluator.js.map +1 -0
- package/dist/collection/lib/evaluation/evaluators/rougeL-evaluator.js +82 -0
- package/dist/collection/lib/evaluation/evaluators/rougeL-evaluator.js.map +1 -0
- package/dist/collection/lib/evaluation/evaluators/rougeL-evaluator.test.js +326 -0
- package/dist/collection/lib/evaluation/evaluators/rougeL-evaluator.test.js.map +1 -0
- package/dist/collection/lib/evaluation/evaluators/semantic/SemanticEvaluator.js +69 -0
- package/dist/collection/lib/evaluation/evaluators/semantic/SemanticEvaluator.js.map +1 -0
- package/dist/collection/lib/evaluation/evaluators/semantic/evaluate-keywords.js +56 -0
- package/dist/collection/lib/evaluation/evaluators/semantic/evaluate-keywords.js.map +1 -0
- package/dist/collection/lib/evaluation/evaluators/semantic/index.js +7 -0
- package/dist/collection/lib/evaluation/evaluators/semantic/index.js.map +1 -0
- package/dist/collection/lib/evaluation/evaluators/semantic/model-loader.js +19 -0
- package/dist/collection/lib/evaluation/evaluators/semantic/model-loader.js.map +1 -0
- package/dist/collection/lib/evaluation/evaluators/semantic/similarity-utils.js +16 -0
- package/dist/collection/lib/evaluation/evaluators/semantic/similarity-utils.js.map +1 -0
- package/dist/collection/lib/evaluation/evaluators/semantic/tests/evaluate-keywords.test.js +65 -0
- package/dist/collection/lib/evaluation/evaluators/semantic/tests/evaluate-keywords.test.js.map +1 -0
- package/dist/collection/lib/evaluation/evaluators/semantic/text-utils.js +5 -0
- package/dist/collection/lib/evaluation/evaluators/semantic/text-utils.js.map +1 -0
- package/dist/collection/lib/evaluation/index.js.map +1 -1
- package/dist/collection/lib/evaluation/rouge1-evaluator.test.js +117 -0
- package/dist/collection/lib/evaluation/rouge1-evaluator.test.js.map +1 -0
- package/dist/collection/lib/evaluation/types.js.map +1 -1
- package/dist/collection/lib/file/file-download.js +18 -0
- package/dist/collection/lib/file/file-download.js.map +1 -0
- package/dist/collection/lib/file/file-reader.js +14 -0
- package/dist/collection/lib/file/file-reader.js.map +1 -0
- package/dist/collection/lib/form/components/app-chips.css +97 -0
- package/dist/collection/lib/form/components/app-chips.js +155 -0
- package/dist/collection/lib/form/components/app-chips.js.map +1 -0
- package/dist/collection/lib/form/components/app-select.css +28 -0
- package/dist/collection/lib/form/components/app-select.js +101 -0
- package/dist/collection/lib/form/components/app-select.js.map +1 -0
- package/dist/collection/lib/form/components/app-textarea.css +38 -0
- package/dist/collection/lib/form/components/app-textarea.js +126 -0
- package/dist/collection/lib/form/components/app-textarea.js.map +1 -0
- package/dist/collection/lib/form/form-builder.js +171 -0
- package/dist/collection/lib/form/form-builder.js.map +1 -0
- package/dist/collection/lib/form/schema/base-input-field-config.js +2 -0
- package/dist/collection/lib/form/schema/base-input-field-config.js.map +1 -0
- package/dist/collection/lib/form/schema/form-control-config.js +2 -0
- package/dist/collection/lib/form/schema/form-control-config.js.map +1 -0
- package/dist/collection/lib/form/schema/index.js +8 -0
- package/dist/collection/lib/form/schema/index.js.map +1 -0
- package/dist/collection/lib/import-export/test-results-csv.js +65 -0
- package/dist/collection/lib/import-export/test-results-csv.js.map +1 -0
- package/dist/collection/lib/import-export/test-suite-exporter.js +15 -0
- package/dist/collection/lib/import-export/test-suite-exporter.js.map +1 -0
- package/dist/collection/lib/import-export/test-suite-importer.js +44 -0
- package/dist/collection/lib/import-export/test-suite-importer.js.map +1 -0
- package/dist/collection/lib/rate-limited-fetcher/rate-limited-fetcher.js +6 -6
- package/dist/collection/lib/rate-limited-fetcher/rate-limited-fetcher.js.map +1 -1
- package/dist/collection/lib/test-cases/test-case-factory.js +56 -0
- package/dist/collection/lib/test-cases/test-case-factory.js.map +1 -0
- package/dist/collection/lib/test-cases/test-case-mutations.js +16 -0
- package/dist/collection/lib/test-cases/test-case-mutations.js.map +1 -0
- package/dist/collection/lib/ui/button/button.css +113 -0
- package/dist/collection/lib/ui/button/button.js +21 -0
- package/dist/collection/lib/ui/button/button.js.map +1 -0
- package/dist/collection/lib/ui/button/index.js +2 -0
- package/dist/collection/lib/ui/button/index.js.map +1 -0
- package/dist/collection/lib/ui/icon-button/icon-button.css +77 -0
- package/dist/collection/lib/ui/icon-button/icon-button.js +19 -0
- package/dist/collection/lib/ui/icon-button/icon-button.js.map +1 -0
- package/dist/collection/lib/ui/icon-button/index.js +2 -0
- package/dist/collection/lib/ui/icon-button/index.js.map +1 -0
- package/dist/collection/services/adapters.js +2 -0
- package/dist/collection/services/adapters.js.map +1 -0
- package/dist/collection/services/models/gemini.js +17 -0
- package/dist/collection/services/models/gemini.js.map +1 -0
- package/dist/collection/styles/tokens.css +180 -0
- package/dist/collection/types/evaluation.js +2 -0
- package/dist/collection/types/evaluation.js.map +1 -0
- package/dist/collection/types/llm-test-runner.js +2 -0
- package/dist/collection/types/llm-test-runner.js.map +1 -0
- package/dist/components/app-chips.d.ts +11 -0
- package/dist/components/app-chips.js +2 -0
- package/dist/components/app-chips.js.map +1 -0
- package/dist/components/app-select.d.ts +11 -0
- package/dist/components/app-select.js +2 -0
- package/dist/components/app-select.js.map +1 -0
- package/dist/components/app-textarea.d.ts +11 -0
- package/dist/components/app-textarea.js +2 -0
- package/dist/components/app-textarea.js.map +1 -0
- package/dist/components/form-builder.d.ts +11 -0
- package/dist/components/form-builder.js +2 -0
- package/dist/components/form-builder.js.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -13
- package/dist/components/index.js.map +1 -1
- package/dist/components/llm-test-runner.js +1 -8
- package/dist/components/llm-test-runner.js.map +1 -1
- package/dist/components/p--2rdv_J9.js +2 -0
- package/dist/components/p--2rdv_J9.js.map +1 -0
- package/dist/components/p-B7J48VNq.js +2 -0
- package/dist/components/p-B7J48VNq.js.map +1 -0
- package/dist/components/p-BCB1rjPS.js +7 -0
- package/dist/components/p-BCB1rjPS.js.map +1 -0
- package/dist/components/p-BQhb2H_a.js +2 -0
- package/dist/components/p-BQhb2H_a.js.map +1 -0
- package/dist/components/p-D9BrlHdP.js +297 -0
- package/dist/components/p-D9BrlHdP.js.map +1 -0
- package/dist/components/p-DtCkZ1g2.js +2 -0
- package/dist/components/p-DtCkZ1g2.js.map +1 -0
- package/dist/esm/app-chips_5.entry.js +153 -0
- package/dist/esm/app-chips_5.entry.js.map +1 -0
- package/dist/esm/app-globals-DbR5vV7d.js +32 -0
- package/dist/esm/app-globals-DbR5vV7d.js.map +1 -0
- package/dist/esm/index-Bvg6mh1M.js +25539 -0
- package/dist/esm/index-Bvg6mh1M.js.map +1 -0
- package/dist/esm/index-DxzhGhec.js +21450 -0
- package/dist/esm/index-DxzhGhec.js.map +1 -0
- package/dist/esm/index.js +4 -486
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/llm-testrunner.js +7 -5
- package/dist/esm/llm-testrunner.js.map +1 -1
- package/dist/esm/loader.js +6 -4
- package/dist/llm-testrunner/index.esm.js +1 -1
- package/dist/llm-testrunner/index.esm.js.map +1 -1
- package/dist/llm-testrunner/llm-testrunner.esm.js +1 -1
- package/dist/llm-testrunner/llm-testrunner.esm.js.map +1 -1
- package/dist/llm-testrunner/p-3f04b0fb.entry.js +2 -0
- package/dist/llm-testrunner/p-3f04b0fb.entry.js.map +1 -0
- package/dist/llm-testrunner/p-DFds8y01.js +7 -0
- package/dist/llm-testrunner/p-DFds8y01.js.map +1 -0
- package/dist/llm-testrunner/p-DxzhGhec.js +298 -0
- package/dist/llm-testrunner/p-DxzhGhec.js.map +1 -0
- package/dist/llm-testrunner/p-GQwFOmwJ.js +2 -0
- package/dist/llm-testrunner/p-GQwFOmwJ.js.map +1 -0
- package/dist/react/components.d.ts +32 -2
- package/dist/react/components.d.ts.map +1 -1
- package/dist/react/components.js +44 -2
- package/dist/types/components/llm-test-runner/header/llm-test-runner-header.d.ts +14 -0
- package/dist/types/components/llm-test-runner/llm-test-runner.d.ts +13 -29
- package/dist/types/components/llm-test-runner/llm-test-runner.import-export.test.d.ts +1 -0
- package/dist/types/components/llm-test-runner/test-cases/actions/row-actions.d.ts +8 -0
- package/dist/types/components/llm-test-runner/test-cases/evaluation/evaluation-summary.d.ts +7 -0
- package/dist/types/components/llm-test-runner/test-cases/llm-test-case-row.d.ts +25 -0
- package/dist/types/components/llm-test-runner/test-cases/llm-test-cases.d.ts +26 -0
- package/dist/types/components/llm-test-runner/test-cases/output/response-output.d.ts +6 -0
- package/dist/types/components.d.ts +199 -4
- package/dist/types/global/env.d.ts +2 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/lib/evaluation/constants.d.ts +11 -0
- package/dist/types/lib/evaluation/evaluation-engine.d.ts +0 -4
- package/dist/types/lib/evaluation/evaluation-service.d.ts +15 -0
- package/dist/types/lib/evaluation/evaluators/bleu/bleu-evaluator.d.ts +18 -0
- package/dist/types/lib/evaluation/evaluators/bleu/tests/bleu.test.d.ts +1 -0
- package/dist/types/lib/evaluation/evaluators/exact/exact.d.ts +2 -0
- package/dist/types/lib/evaluation/evaluators/rouge1-evaluator.d.ts +17 -0
- package/dist/types/lib/evaluation/evaluators/rougeL-evaluator.d.ts +2 -0
- package/dist/types/lib/evaluation/evaluators/rougeL-evaluator.test.d.ts +1 -0
- package/dist/types/lib/evaluation/evaluators/semantic/SemanticEvaluator.d.ts +6 -0
- package/dist/types/lib/evaluation/evaluators/semantic/evaluate-keywords.d.ts +7 -0
- package/dist/types/lib/evaluation/evaluators/semantic/index.d.ts +2 -0
- package/dist/types/lib/evaluation/evaluators/semantic/model-loader.d.ts +1 -0
- package/dist/types/lib/evaluation/evaluators/semantic/similarity-utils.d.ts +1 -0
- package/dist/types/lib/evaluation/evaluators/semantic/tests/evaluate-keywords.test.d.ts +1 -0
- package/dist/types/lib/evaluation/evaluators/semantic/text-utils.d.ts +1 -0
- package/dist/types/lib/evaluation/index.d.ts +2 -2
- package/dist/types/lib/evaluation/rouge1-evaluator.test.d.ts +1 -0
- package/dist/types/lib/evaluation/types.d.ts +19 -7
- package/dist/types/lib/file/file-download.d.ts +7 -0
- package/dist/types/lib/file/file-reader.d.ts +6 -0
- package/dist/types/lib/form/components/app-chips.d.ts +20 -0
- package/dist/types/lib/form/components/app-select.d.ts +7 -0
- package/dist/types/lib/form/components/app-textarea.d.ts +14 -0
- package/dist/types/lib/form/form-builder.d.ts +24 -0
- package/dist/types/lib/form/schema/base-input-field-config.d.ts +37 -0
- package/dist/types/lib/form/schema/form-control-config.d.ts +13 -0
- package/dist/types/lib/form/schema/index.d.ts +9 -0
- package/dist/types/lib/import-export/test-results-csv.d.ts +13 -0
- package/dist/types/lib/import-export/test-suite-exporter.d.ts +16 -0
- package/dist/types/lib/import-export/test-suite-importer.d.ts +12 -0
- package/dist/types/lib/rate-limited-fetcher/rate-limited-fetcher.d.ts +1 -1
- package/dist/types/lib/test-cases/test-case-factory.d.ts +12 -0
- package/dist/types/lib/test-cases/test-case-mutations.d.ts +9 -0
- package/dist/types/lib/ui/button/button.d.ts +13 -0
- package/dist/types/lib/ui/button/index.d.ts +2 -0
- package/dist/types/lib/ui/icon-button/icon-button.d.ts +11 -0
- package/dist/types/lib/ui/icon-button/index.d.ts +2 -0
- package/dist/types/services/adapters.d.ts +3 -0
- package/dist/types/services/models/gemini.d.ts +11 -0
- package/dist/types/stencil-public-runtime.d.ts +110 -6
- package/dist/types/types/evaluation.d.ts +9 -0
- package/dist/types/types/llm-test-runner.d.ts +22 -0
- package/package.json +30 -6
- package/dist/cjs/app-globals-CbbEbofA.js +0 -14
- package/dist/cjs/app-globals-CbbEbofA.js.map +0 -1
- package/dist/cjs/index-D-FySkoV.js +0 -1470
- package/dist/cjs/index-D-FySkoV.js.map +0 -1
- package/dist/cjs/llm-test-runner.cjs.entry.js +0 -9
- package/dist/cjs/llm-test-runner.entry.cjs.js.map +0 -1
- package/dist/components/p-CYUbsbxt.js +0 -1770
- package/dist/components/p-CYUbsbxt.js.map +0 -1
- package/dist/esm/app-globals-BOQOUavG.js +0 -12
- package/dist/esm/app-globals-BOQOUavG.js.map +0 -1
- package/dist/esm/index-cncubhtM.js +0 -1463
- package/dist/esm/index-cncubhtM.js.map +0 -1
- package/dist/esm/llm-test-runner.entry.js +0 -3
- package/dist/esm/llm-test-runner.entry.js.map +0 -1
- package/dist/llm-testrunner/llm-test-runner.entry.esm.js.map +0 -1
- package/dist/llm-testrunner/loader.esm.js.map +0 -1
- package/dist/llm-testrunner/p-BOQOUavG.js +0 -2
- package/dist/llm-testrunner/p-BOQOUavG.js.map +0 -1
- package/dist/llm-testrunner/p-cncubhtM.js +0 -3
- package/dist/llm-testrunner/p-cncubhtM.js.map +0 -1
- package/dist/llm-testrunner/p-f68fd660.entry.js +0 -2
- package/dist/llm-testrunner/p-f68fd660.entry.js.map +0 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export class AppSelect {
|
|
3
|
+
value;
|
|
4
|
+
onChange;
|
|
5
|
+
config;
|
|
6
|
+
render() {
|
|
7
|
+
const c = this.config;
|
|
8
|
+
const allowedAttrs = {
|
|
9
|
+
id: c.name,
|
|
10
|
+
name: c.name,
|
|
11
|
+
disabled: c.disabled,
|
|
12
|
+
required: c.required,
|
|
13
|
+
readOnly: c.readOnly,
|
|
14
|
+
placeholder: c.placeholder,
|
|
15
|
+
autocomplete: c.autocomplete,
|
|
16
|
+
optionList: c.optionList,
|
|
17
|
+
};
|
|
18
|
+
return (h("div", { key: '9c1db3cb191224e9a947422ee5f435f465cc6dab', class: "app-select" }, c.label && (h("label", { key: '760325a0a77befdbf6739a527384b396ca77b27e', class: "app-select__label", htmlFor: c.name }, c.label)), h("div", { key: 'f164d797209ced876a482452aeeeeb2f027dc2da' }, h("select", { key: '5e82f93ff288e66d3aabd2d4ad4aafd0377cfe35', ...allowedAttrs, class: "app-select__select", onInput: (e) => {
|
|
19
|
+
const raw = e.target.value;
|
|
20
|
+
const matched = c.optionList.find(opt => String(opt) === raw);
|
|
21
|
+
this.onChange?.(matched !== undefined ? matched : raw);
|
|
22
|
+
} }, c.optionList?.map(option => (h("option", { value: String(option), key: String(option), selected: this.value === option }, String(option))))))));
|
|
23
|
+
}
|
|
24
|
+
static get is() { return "app-select"; }
|
|
25
|
+
static get encapsulation() { return "shadow"; }
|
|
26
|
+
static get originalStyleUrls() {
|
|
27
|
+
return {
|
|
28
|
+
"$": ["app-select.css"]
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
static get styleUrls() {
|
|
32
|
+
return {
|
|
33
|
+
"$": ["app-select.css"]
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
static get properties() {
|
|
37
|
+
return {
|
|
38
|
+
"value": {
|
|
39
|
+
"type": "any",
|
|
40
|
+
"mutable": false,
|
|
41
|
+
"complexType": {
|
|
42
|
+
"original": "any",
|
|
43
|
+
"resolved": "any",
|
|
44
|
+
"references": {}
|
|
45
|
+
},
|
|
46
|
+
"required": false,
|
|
47
|
+
"optional": false,
|
|
48
|
+
"docs": {
|
|
49
|
+
"tags": [],
|
|
50
|
+
"text": ""
|
|
51
|
+
},
|
|
52
|
+
"getter": false,
|
|
53
|
+
"setter": false,
|
|
54
|
+
"reflect": false,
|
|
55
|
+
"attribute": "value"
|
|
56
|
+
},
|
|
57
|
+
"onChange": {
|
|
58
|
+
"type": "unknown",
|
|
59
|
+
"mutable": false,
|
|
60
|
+
"complexType": {
|
|
61
|
+
"original": "(value: any) => void",
|
|
62
|
+
"resolved": "(value: any) => void",
|
|
63
|
+
"references": {}
|
|
64
|
+
},
|
|
65
|
+
"required": false,
|
|
66
|
+
"optional": false,
|
|
67
|
+
"docs": {
|
|
68
|
+
"tags": [],
|
|
69
|
+
"text": ""
|
|
70
|
+
},
|
|
71
|
+
"getter": false,
|
|
72
|
+
"setter": false
|
|
73
|
+
},
|
|
74
|
+
"config": {
|
|
75
|
+
"type": "unknown",
|
|
76
|
+
"mutable": false,
|
|
77
|
+
"complexType": {
|
|
78
|
+
"original": "SelectConfig",
|
|
79
|
+
"resolved": "SelectConfig",
|
|
80
|
+
"references": {
|
|
81
|
+
"SelectConfig": {
|
|
82
|
+
"location": "import",
|
|
83
|
+
"path": "../schema",
|
|
84
|
+
"id": "src/lib/form/schema/index.ts::SelectConfig",
|
|
85
|
+
"referenceLocation": "SelectConfig"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"required": false,
|
|
90
|
+
"optional": false,
|
|
91
|
+
"docs": {
|
|
92
|
+
"tags": [],
|
|
93
|
+
"text": ""
|
|
94
|
+
},
|
|
95
|
+
"getter": false,
|
|
96
|
+
"setter": false
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=app-select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-select.js","sourceRoot":"","sources":["../../../../src/lib/form/components/app-select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAQnD,MAAM,OAAO,SAAS;IACZ,KAAK,CAAM;IACX,QAAQ,CAAuB;IAC/B,MAAM,CAAe;IAE7B,MAAM;QACJ,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACtB,MAAM,YAAY,GAAG;YACnB,EAAE,EAAE,CAAC,CAAC,IAAI;YACV,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,WAAW,EAAE,CAAC,CAAC,WAAW;YAC1B,YAAY,EAAE,CAAC,CAAC,YAAY;YAC5B,UAAU,EAAE,CAAC,CAAC,UAAU;SACzB,CAAC;QACF,OAAO,CACL,4DAAK,KAAK,EAAC,YAAY;YACpB,CAAC,CAAC,KAAK,IAAI,CACV,8DAAO,KAAK,EAAC,mBAAmB,EAAC,OAAO,EAAE,CAAC,CAAC,IAAI,IAC7C,CAAC,CAAC,KAAK,CACF,CACT;YAED;gBACE,kEACM,YAAY,EAChB,KAAK,EAAC,oBAAoB,EAC1B,OAAO,EAAE,CAAC,CAAQ,EAAE,EAAE;wBACpB,MAAM,GAAG,GAAI,CAAC,CAAC,MAA4B,CAAC,KAAK,CAAC;wBAClD,MAAM,OAAO,GAAG,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;wBAC9D,IAAI,CAAC,QAAQ,EAAE,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;oBACzD,CAAC,IAEA,CAAC,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAC3B,cACE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EACrB,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,EACnB,QAAQ,EAAE,IAAI,CAAC,KAAK,KAAK,MAAM,IAE9B,MAAM,CAAC,MAAM,CAAC,CACR,CACV,CAAC,CACK,CACL,CACF,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, h } from '@stencil/core';\nimport { SelectConfig } from '../schema';\n\n@Component({\n tag: 'app-select',\n styleUrl: 'app-select.css',\n shadow: true,\n})\nexport class AppSelect {\n @Prop() value: any;\n @Prop() onChange: (value: any) => void;\n @Prop() config: SelectConfig;\n\n render() {\n const c = this.config;\n const allowedAttrs = {\n id: c.name,\n name: c.name,\n disabled: c.disabled,\n required: c.required,\n readOnly: c.readOnly,\n placeholder: c.placeholder,\n autocomplete: c.autocomplete,\n optionList: c.optionList,\n };\n return (\n <div class=\"app-select\">\n {c.label && (\n <label class=\"app-select__label\" htmlFor={c.name}>\n {c.label}\n </label>\n )}\n\n <div>\n <select\n {...allowedAttrs}\n class=\"app-select__select\"\n onInput={(e: Event) => {\n const raw = (e.target as HTMLSelectElement).value;\n const matched = c.optionList.find(opt => String(opt) === raw);\n this.onChange?.(matched !== undefined ? matched : raw);\n }}\n >\n {c.optionList?.map(option => (\n <option\n value={String(option)}\n key={String(option)}\n selected={this.value === option}\n >\n {String(option)}\n </option>\n ))}\n </select>\n </div>\n </div>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.textarea-wrapper {
|
|
2
|
+
margin-bottom: var(--spacing-4);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.textarea-label {
|
|
6
|
+
display: block;
|
|
7
|
+
margin-bottom: var(--spacing-2);
|
|
8
|
+
font-weight: var(--font-weight-medium);
|
|
9
|
+
color: var(--foreground);
|
|
10
|
+
font-size: var(--font-size-sm);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.textarea-element {
|
|
14
|
+
width: 95%;
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
padding: var(--spacing-3);
|
|
17
|
+
border: 2px solid var(--input);
|
|
18
|
+
border-radius: var(--radius);
|
|
19
|
+
font-size: var(--font-size-sm);
|
|
20
|
+
resize: vertical;
|
|
21
|
+
outline: none;
|
|
22
|
+
transition: border-color 0.2s ease;
|
|
23
|
+
font-family: inherit;
|
|
24
|
+
background: var(--background);
|
|
25
|
+
color: var(--foreground);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.textarea-element:focus {
|
|
29
|
+
border-color: var(--ring);
|
|
30
|
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.help-text {
|
|
34
|
+
margin-top: var(--spacing-1);
|
|
35
|
+
font-size: var(--font-size-xs);
|
|
36
|
+
color: var(--muted-foreground, #6b7280);
|
|
37
|
+
line-height: 1.4;
|
|
38
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export class AppTextarea {
|
|
3
|
+
testCaseId;
|
|
4
|
+
value;
|
|
5
|
+
config;
|
|
6
|
+
valueChange;
|
|
7
|
+
handleChange = (e) => {
|
|
8
|
+
const target = e.target;
|
|
9
|
+
this.valueChange.emit({
|
|
10
|
+
key: this.config.name,
|
|
11
|
+
value: target.value,
|
|
12
|
+
testCaseId: this.testCaseId,
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
render() {
|
|
16
|
+
const c = this.config;
|
|
17
|
+
const allowedAttrs = {
|
|
18
|
+
placeholder: c.placeholder,
|
|
19
|
+
required: c.required,
|
|
20
|
+
disabled: c.disabled,
|
|
21
|
+
readOnly: c.readOnly,
|
|
22
|
+
rows: c.rows,
|
|
23
|
+
id: c.name,
|
|
24
|
+
name: c.name,
|
|
25
|
+
autocomplete: c.autocomplete,
|
|
26
|
+
};
|
|
27
|
+
return (h("div", { key: 'b402c7e109f79c1d331dc1a6c77abaf28ad62ea3', class: "textarea-wrapper" }, c.label && (h("label", { key: '2e314cd2ad7fc00d5e910422cf073490f72ccf88', class: "textarea-label", htmlFor: c.name }, c.label)), h("textarea", { key: 'f25add7ec3efa9d58073df5baefd7f71c78ead39', ...allowedAttrs, class: "textarea-element", value: this.value, onInput: this.handleChange }), c.helpText && h("p", { key: '8773a9bd2d4548e823339f7bcd0275dc58f9c212', class: "help-text" }, c.helpText)));
|
|
28
|
+
}
|
|
29
|
+
static get is() { return "app-textarea"; }
|
|
30
|
+
static get encapsulation() { return "shadow"; }
|
|
31
|
+
static get originalStyleUrls() {
|
|
32
|
+
return {
|
|
33
|
+
"$": ["app-textarea.css"]
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
static get styleUrls() {
|
|
37
|
+
return {
|
|
38
|
+
"$": ["app-textarea.css"]
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
static get properties() {
|
|
42
|
+
return {
|
|
43
|
+
"testCaseId": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"mutable": false,
|
|
46
|
+
"complexType": {
|
|
47
|
+
"original": "string",
|
|
48
|
+
"resolved": "string",
|
|
49
|
+
"references": {}
|
|
50
|
+
},
|
|
51
|
+
"required": false,
|
|
52
|
+
"optional": false,
|
|
53
|
+
"docs": {
|
|
54
|
+
"tags": [],
|
|
55
|
+
"text": ""
|
|
56
|
+
},
|
|
57
|
+
"getter": false,
|
|
58
|
+
"setter": false,
|
|
59
|
+
"reflect": false,
|
|
60
|
+
"attribute": "test-case-id"
|
|
61
|
+
},
|
|
62
|
+
"value": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"mutable": false,
|
|
65
|
+
"complexType": {
|
|
66
|
+
"original": "string",
|
|
67
|
+
"resolved": "string",
|
|
68
|
+
"references": {}
|
|
69
|
+
},
|
|
70
|
+
"required": false,
|
|
71
|
+
"optional": false,
|
|
72
|
+
"docs": {
|
|
73
|
+
"tags": [],
|
|
74
|
+
"text": ""
|
|
75
|
+
},
|
|
76
|
+
"getter": false,
|
|
77
|
+
"setter": false,
|
|
78
|
+
"reflect": false,
|
|
79
|
+
"attribute": "value"
|
|
80
|
+
},
|
|
81
|
+
"config": {
|
|
82
|
+
"type": "unknown",
|
|
83
|
+
"mutable": false,
|
|
84
|
+
"complexType": {
|
|
85
|
+
"original": "TextAreaConfig",
|
|
86
|
+
"resolved": "TextAreaConfig",
|
|
87
|
+
"references": {
|
|
88
|
+
"TextAreaConfig": {
|
|
89
|
+
"location": "import",
|
|
90
|
+
"path": "../schema",
|
|
91
|
+
"id": "src/lib/form/schema/index.ts::TextAreaConfig",
|
|
92
|
+
"referenceLocation": "TextAreaConfig"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"required": false,
|
|
97
|
+
"optional": false,
|
|
98
|
+
"docs": {
|
|
99
|
+
"tags": [],
|
|
100
|
+
"text": ""
|
|
101
|
+
},
|
|
102
|
+
"getter": false,
|
|
103
|
+
"setter": false
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
static get events() {
|
|
108
|
+
return [{
|
|
109
|
+
"method": "valueChange",
|
|
110
|
+
"name": "valueChange",
|
|
111
|
+
"bubbles": true,
|
|
112
|
+
"cancelable": true,
|
|
113
|
+
"composed": true,
|
|
114
|
+
"docs": {
|
|
115
|
+
"tags": [],
|
|
116
|
+
"text": ""
|
|
117
|
+
},
|
|
118
|
+
"complexType": {
|
|
119
|
+
"original": "{\n key: string;\n value: string;\n testCaseId: string;\n }",
|
|
120
|
+
"resolved": "{ key: string; value: string; testCaseId: string; }",
|
|
121
|
+
"references": {}
|
|
122
|
+
}
|
|
123
|
+
}];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=app-textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-textarea.js","sourceRoot":"","sources":["../../../../src/lib/form/components/app-textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAQxE,MAAM,OAAO,WAAW;IACd,UAAU,CAAS;IACnB,KAAK,CAAS;IACd,MAAM,CAAiB;IAEtB,WAAW,CAIjB;IAEK,YAAY,GAAG,CAAC,CAAQ,EAAE,EAAE;QAClC,MAAM,MAAM,GAAG,CAAC,CAAC,MAA6B,CAAC;QAE/C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;YACpB,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;YACrB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM;QACJ,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QAEtB,MAAM,YAAY,GAAG;YACnB,WAAW,EAAE,CAAC,CAAC,WAAW;YAC1B,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,EAAE,EAAE,CAAC,CAAC,IAAI;YACV,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,YAAY,EAAE,CAAC,CAAC,YAAY;SAC7B,CAAC;QAEF,OAAO,CACL,4DAAK,KAAK,EAAC,kBAAkB;YAC1B,CAAC,CAAC,KAAK,IAAI,CACV,8DAAO,KAAK,EAAC,gBAAgB,EAAC,OAAO,EAAE,CAAC,CAAC,IAAI,IAC1C,CAAC,CAAC,KAAK,CACF,CACT;YAED,oEACM,YAAY,EAChB,KAAK,EAAC,kBAAkB,EACxB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,IAAI,CAAC,YAAY,GAChB;YAEX,CAAC,CAAC,QAAQ,IAAI,0DAAG,KAAK,EAAC,WAAW,IAAE,CAAC,CAAC,QAAQ,CAAK,CAChD,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, Prop, h } from '@stencil/core';\nimport { TextAreaConfig } from '../schema';\n\n@Component({\n tag: 'app-textarea',\n styleUrl: 'app-textarea.css',\n shadow: true,\n})\nexport class AppTextarea {\n @Prop() testCaseId: string;\n @Prop() value: string;\n @Prop() config: TextAreaConfig;\n\n @Event() valueChange: EventEmitter<{\n key: string;\n value: string;\n testCaseId: string;\n }>;\n\n private handleChange = (e: Event) => {\n const target = e.target as HTMLTextAreaElement;\n\n this.valueChange.emit({\n key: this.config.name,\n value: target.value,\n testCaseId: this.testCaseId,\n });\n };\n\n render() {\n const c = this.config;\n\n const allowedAttrs = {\n placeholder: c.placeholder,\n required: c.required,\n disabled: c.disabled,\n readOnly: c.readOnly,\n rows: c.rows,\n id: c.name,\n name: c.name,\n autocomplete: c.autocomplete,\n };\n\n return (\n <div class=\"textarea-wrapper\">\n {c.label && (\n <label class=\"textarea-label\" htmlFor={c.name}>\n {c.label}\n </label>\n )}\n\n <textarea\n {...allowedAttrs}\n class=\"textarea-element\"\n value={this.value}\n onInput={this.handleChange}\n ></textarea>\n\n {c.helpText && <p class=\"help-text\">{c.helpText}</p>}\n </div>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { FormFieldType, } from "./schema";
|
|
3
|
+
export class FormBuilder {
|
|
4
|
+
fields = [];
|
|
5
|
+
onUpdateApproach;
|
|
6
|
+
testCase;
|
|
7
|
+
handleTestCaseChange;
|
|
8
|
+
addChip;
|
|
9
|
+
removeChip;
|
|
10
|
+
renderField(field) {
|
|
11
|
+
switch (field.fieldType) {
|
|
12
|
+
case FormFieldType.TEXT_AREA:
|
|
13
|
+
return (h("app-textarea", { config: field, value: this.testCase[field.name], testCaseId: this.testCase.id, onValueChange: this.handleTestCaseChange }));
|
|
14
|
+
case FormFieldType.CHIPS:
|
|
15
|
+
return (h("app-chips", { config: field, value: this.testCase[field.name], testCaseId: this.testCase.id, onAddChip: this.addChip, onRemoveChip: this.removeChip }));
|
|
16
|
+
case FormFieldType.SELECT:
|
|
17
|
+
return (h("app-select", { config: field, value: this.testCase.evaluationParameters?.approach, onChange: approach => this.onUpdateApproach(this.testCase, approach) }));
|
|
18
|
+
default:
|
|
19
|
+
return h("div", null, "Unknown field type");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
return (h("div", { key: '01e89f827a4adfb53e4dd4d5acfc55c323ad3788', class: "form-builder" }, this.fields.map(field => this.renderField(field))));
|
|
24
|
+
}
|
|
25
|
+
static get is() { return "form-builder"; }
|
|
26
|
+
static get encapsulation() { return "shadow"; }
|
|
27
|
+
static get properties() {
|
|
28
|
+
return {
|
|
29
|
+
"fields": {
|
|
30
|
+
"type": "unknown",
|
|
31
|
+
"mutable": false,
|
|
32
|
+
"complexType": {
|
|
33
|
+
"original": "FieldConfig[]",
|
|
34
|
+
"resolved": "FieldConfig[]",
|
|
35
|
+
"references": {
|
|
36
|
+
"FieldConfig": {
|
|
37
|
+
"location": "import",
|
|
38
|
+
"path": "./schema",
|
|
39
|
+
"id": "src/lib/form/schema/index.ts::FieldConfig",
|
|
40
|
+
"referenceLocation": "FieldConfig"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"required": false,
|
|
45
|
+
"optional": false,
|
|
46
|
+
"docs": {
|
|
47
|
+
"tags": [],
|
|
48
|
+
"text": ""
|
|
49
|
+
},
|
|
50
|
+
"getter": false,
|
|
51
|
+
"setter": false,
|
|
52
|
+
"defaultValue": "[]"
|
|
53
|
+
},
|
|
54
|
+
"onUpdateApproach": {
|
|
55
|
+
"type": "unknown",
|
|
56
|
+
"mutable": false,
|
|
57
|
+
"complexType": {
|
|
58
|
+
"original": "(testCase: TestCase, approach: any) => void",
|
|
59
|
+
"resolved": "(testCase: TestCase, approach: any) => void",
|
|
60
|
+
"references": {
|
|
61
|
+
"TestCase": {
|
|
62
|
+
"location": "import",
|
|
63
|
+
"path": "../../types/llm-test-runner",
|
|
64
|
+
"id": "src/types/llm-test-runner.ts::TestCase",
|
|
65
|
+
"referenceLocation": "TestCase"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"required": false,
|
|
70
|
+
"optional": false,
|
|
71
|
+
"docs": {
|
|
72
|
+
"tags": [],
|
|
73
|
+
"text": ""
|
|
74
|
+
},
|
|
75
|
+
"getter": false,
|
|
76
|
+
"setter": false
|
|
77
|
+
},
|
|
78
|
+
"testCase": {
|
|
79
|
+
"type": "unknown",
|
|
80
|
+
"mutable": false,
|
|
81
|
+
"complexType": {
|
|
82
|
+
"original": "TestCase",
|
|
83
|
+
"resolved": "TestCase",
|
|
84
|
+
"references": {
|
|
85
|
+
"TestCase": {
|
|
86
|
+
"location": "import",
|
|
87
|
+
"path": "../../types/llm-test-runner",
|
|
88
|
+
"id": "src/types/llm-test-runner.ts::TestCase",
|
|
89
|
+
"referenceLocation": "TestCase"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"required": false,
|
|
94
|
+
"optional": false,
|
|
95
|
+
"docs": {
|
|
96
|
+
"tags": [],
|
|
97
|
+
"text": ""
|
|
98
|
+
},
|
|
99
|
+
"getter": false,
|
|
100
|
+
"setter": false
|
|
101
|
+
},
|
|
102
|
+
"handleTestCaseChange": {
|
|
103
|
+
"type": "unknown",
|
|
104
|
+
"mutable": false,
|
|
105
|
+
"complexType": {
|
|
106
|
+
"original": "(\n e: CustomEvent<{ testCaseId: string; key: string; value: string }>,\n ) => void",
|
|
107
|
+
"resolved": "(e: CustomEvent<{ testCaseId: string; key: string; value: string; }>) => void",
|
|
108
|
+
"references": {
|
|
109
|
+
"CustomEvent": {
|
|
110
|
+
"location": "global",
|
|
111
|
+
"id": "global::CustomEvent"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"required": false,
|
|
116
|
+
"optional": false,
|
|
117
|
+
"docs": {
|
|
118
|
+
"tags": [],
|
|
119
|
+
"text": ""
|
|
120
|
+
},
|
|
121
|
+
"getter": false,
|
|
122
|
+
"setter": false
|
|
123
|
+
},
|
|
124
|
+
"addChip": {
|
|
125
|
+
"type": "unknown",
|
|
126
|
+
"mutable": false,
|
|
127
|
+
"complexType": {
|
|
128
|
+
"original": "(\n e: CustomEvent<{ testCaseId: string; key: string; value: string }>,\n ) => void",
|
|
129
|
+
"resolved": "(e: CustomEvent<{ testCaseId: string; key: string; value: string; }>) => void",
|
|
130
|
+
"references": {
|
|
131
|
+
"CustomEvent": {
|
|
132
|
+
"location": "global",
|
|
133
|
+
"id": "global::CustomEvent"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"required": false,
|
|
138
|
+
"optional": false,
|
|
139
|
+
"docs": {
|
|
140
|
+
"tags": [],
|
|
141
|
+
"text": ""
|
|
142
|
+
},
|
|
143
|
+
"getter": false,
|
|
144
|
+
"setter": false
|
|
145
|
+
},
|
|
146
|
+
"removeChip": {
|
|
147
|
+
"type": "unknown",
|
|
148
|
+
"mutable": false,
|
|
149
|
+
"complexType": {
|
|
150
|
+
"original": "(\n e: CustomEvent<{ testCaseId: string; key: string; index: number }>,\n ) => void",
|
|
151
|
+
"resolved": "(e: CustomEvent<{ testCaseId: string; key: string; index: number; }>) => void",
|
|
152
|
+
"references": {
|
|
153
|
+
"CustomEvent": {
|
|
154
|
+
"location": "global",
|
|
155
|
+
"id": "global::CustomEvent"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"required": false,
|
|
160
|
+
"optional": false,
|
|
161
|
+
"docs": {
|
|
162
|
+
"tags": [],
|
|
163
|
+
"text": ""
|
|
164
|
+
},
|
|
165
|
+
"getter": false,
|
|
166
|
+
"setter": false
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=form-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-builder.js","sourceRoot":"","sources":["../../../src/lib/form/form-builder.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAGL,aAAa,GAGd,MAAM,UAAU,CAAC;AAOlB,MAAM,OAAO,WAAW;IACd,MAAM,GAAkB,EAAE,CAAC;IAC3B,gBAAgB,CAA8C;IAC9D,QAAQ,CAAW;IACnB,oBAAoB,CAElB;IACF,OAAO,CAEL;IACF,UAAU,CAER;IAEV,WAAW,CAAC,KAAkB;QAC5B,QAAQ,KAAK,CAAC,SAAS,EAAE,CAAC;YACxB,KAAK,aAAa,CAAC,SAAS;gBAC1B,OAAO,CACL,oBACE,MAAM,EAAE,KAAuB,EAC/B,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EAChC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAC5B,aAAa,EAAE,IAAI,CAAC,oBAAoB,GAC1B,CACjB,CAAC;YAEJ,KAAK,aAAa,CAAC,KAAK;gBACtB,OAAO,CACL,iBACE,MAAM,EAAE,KAAoB,EAC5B,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EAChC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAC5B,SAAS,EAAE,IAAI,CAAC,OAAO,EACvB,YAAY,EAAE,IAAI,CAAC,UAAU,GAC7B,CACH,CAAC;YAEJ,KAAK,aAAa,CAAC,MAAM;gBACvB,OAAO,CACL,kBACE,MAAM,EAAE,KAAqB,EAC7B,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,oBAAoB,EAAE,QAAQ,EACnD,QAAQ,EAAE,QAAQ,CAAC,EAAE,CACnB,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAEhD,CACH,CAAC;YAEJ;gBACE,OAAO,oCAA6B,CAAC;QACzC,CAAC;IACH,CAAC;IAED,MAAM;QACJ,OAAO,CACL,4DAAK,KAAK,EAAC,cAAc,IACtB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAC9C,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop } from '@stencil/core';\n\nimport {\n ChipsConfig,\n FieldConfig,\n FormFieldType,\n SelectConfig,\n TextAreaConfig,\n} from './schema';\nimport { TestCase } from '../../types/llm-test-runner';\n\n@Component({\n tag: 'form-builder',\n shadow: true,\n})\nexport class FormBuilder {\n @Prop() fields: FieldConfig[] = [];\n @Prop() onUpdateApproach: (testCase: TestCase, approach: any) => void;\n @Prop() testCase: TestCase;\n @Prop() handleTestCaseChange: (\n e: CustomEvent<{ testCaseId: string; key: string; value: string }>,\n ) => void;\n @Prop() addChip: (\n e: CustomEvent<{ testCaseId: string; key: string; value: string }>,\n ) => void;\n @Prop() removeChip: (\n e: CustomEvent<{ testCaseId: string; key: string; index: number }>,\n ) => void;\n\n renderField(field: FieldConfig) {\n switch (field.fieldType) {\n case FormFieldType.TEXT_AREA:\n return (\n <app-textarea\n config={field as TextAreaConfig}\n value={this.testCase[field.name]}\n testCaseId={this.testCase.id}\n onValueChange={this.handleTestCaseChange}\n ></app-textarea>\n );\n\n case FormFieldType.CHIPS:\n return (\n <app-chips\n config={field as ChipsConfig}\n value={this.testCase[field.name]}\n testCaseId={this.testCase.id}\n onAddChip={this.addChip}\n onRemoveChip={this.removeChip}\n />\n );\n\n case FormFieldType.SELECT:\n return (\n <app-select\n config={field as SelectConfig}\n value={this.testCase.evaluationParameters?.approach}\n onChange={approach =>\n this.onUpdateApproach(this.testCase, approach)\n }\n />\n );\n\n default:\n return <div>Unknown field type</div>;\n }\n }\n\n render() {\n return (\n <div class=\"form-builder\">\n {this.fields.map(field => this.renderField(field))}\n </div>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-input-field-config.js","sourceRoot":"","sources":["../../../../src/lib/form/schema/base-input-field-config.ts"],"names":[],"mappings":"","sourcesContent":["import { FormFieldType } from '.';\n\n/**\n * - minLength / maxLength: character limits\n * - min / max: numeric or date boundaries\n * - step: allowed increment between numeric values (e.g., 0.5 → 0, 0.5, 1.0...)\n * - custom: custom validator returning error message or null\n */\nexport interface InputFieldValidation {\n required?: boolean | string;\n minLength?: number;\n maxLength?: number;\n pattern?: RegExp | string;\n min?: number | string | Date;\n max?: number | string | Date;\n step?: number;\n custom?: (value: any, allValues?: Record<string, any>) => string | null;\n}\n\n/**\n * - helpText:Field Support text\n */\nexport interface BaseInputFieldConfig {\n name: string;\n fieldType: FormFieldType;\n type?: string;\n label?: string;\n placeholder?: string;\n defaultValue?: any;\n autocomplete?: string;\n required?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n helpText?: string;\n validation?: InputFieldValidation;\n hidden?: boolean;\n className?: string;\n style?: Record<string, any>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-control-config.js","sourceRoot":"","sources":["../../../../src/lib/form/schema/form-control-config.ts"],"names":[],"mappings":"","sourcesContent":["import { FormFieldType } from '.';\nimport { BaseInputFieldConfig } from './base-input-field-config';\n\nexport interface TextAreaConfig extends BaseInputFieldConfig {\n fieldType: FormFieldType.TEXT_AREA;\n rows?: number;\n}\n\nexport interface ChipsConfig extends BaseInputFieldConfig {\n fieldType: FormFieldType.CHIPS;\n}\n\nexport interface SelectConfig extends BaseInputFieldConfig {\n fieldType: FormFieldType.SELECT;\n optionList: any[];\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var FormFieldType;
|
|
2
|
+
(function (FormFieldType) {
|
|
3
|
+
FormFieldType["TEXT_AREA"] = "textarea";
|
|
4
|
+
FormFieldType["CHIPS"] = "chips";
|
|
5
|
+
FormFieldType["SELECT"] = "select";
|
|
6
|
+
})(FormFieldType || (FormFieldType = {}));
|
|
7
|
+
export { FormFieldType, };
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/form/schema/index.ts"],"names":[],"mappings":"AAYA,IAAK,aAIJ;AAJD,WAAK,aAAa;IAChB,uCAAsB,CAAA;IACtB,gCAAe,CAAA;IACf,kCAAiB,CAAA;AACnB,CAAC,EAJI,aAAa,KAAb,aAAa,QAIjB;AAED,OAAO,EAOL,aAAa,GACd,CAAC","sourcesContent":["import {\n InputFieldValidation,\n BaseInputFieldConfig,\n} from './base-input-field-config';\nimport {\n ChipsConfig,\n TextAreaConfig,\n SelectConfig,\n} from './form-control-config';\n\ntype FieldConfig = TextAreaConfig | ChipsConfig | SelectConfig;\n\nenum FormFieldType {\n TEXT_AREA = 'textarea',\n CHIPS = 'chips',\n SELECT = 'select',\n}\n\nexport {\n InputFieldValidation,\n BaseInputFieldConfig,\n TextAreaConfig,\n ChipsConfig,\n SelectConfig,\n FieldConfig,\n FormFieldType,\n};\n"]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escapes a CSV field by wrapping it in quotes if it contains special characters
|
|
3
|
+
* @param field - The field to escape
|
|
4
|
+
* @returns Escaped field string
|
|
5
|
+
*/
|
|
6
|
+
export function escapeCsvField(field) {
|
|
7
|
+
if (field.includes(',') || field.includes('"') || field.includes('\n')) {
|
|
8
|
+
return `"${field.replace(/"/g, '""')}"`;
|
|
9
|
+
}
|
|
10
|
+
return field;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Exports test results to a CSV string
|
|
14
|
+
* @param testCases - Array of test cases with results to export
|
|
15
|
+
* @returns CSV string representation of the test results
|
|
16
|
+
*/
|
|
17
|
+
export function exportTestResultsToCsv(testCases) {
|
|
18
|
+
const csvRows = [];
|
|
19
|
+
// Add header row
|
|
20
|
+
const headers = [
|
|
21
|
+
'Question',
|
|
22
|
+
'Expected Keywords',
|
|
23
|
+
'Generated Keywords',
|
|
24
|
+
'Keywords Match',
|
|
25
|
+
'Response Time (s)',
|
|
26
|
+
'Evaluation Approach',
|
|
27
|
+
'Evaluation Score',
|
|
28
|
+
];
|
|
29
|
+
csvRows.push(headers.join(','));
|
|
30
|
+
// Add data rows
|
|
31
|
+
testCases.forEach(testCase => {
|
|
32
|
+
const expectedOutcome = testCase.expectedOutcome || '';
|
|
33
|
+
const evaluationApproach = testCase.evaluationParameters?.approach || '';
|
|
34
|
+
const score = testCase.evaluationResult?.evaluationApproachResult?.score;
|
|
35
|
+
const evaluationScore = score !== undefined ? score.toString() : '';
|
|
36
|
+
let generatedKeywords = '';
|
|
37
|
+
let keywordsMatch = '';
|
|
38
|
+
if (testCase.evaluationResult) {
|
|
39
|
+
const foundKeywords = testCase.evaluationResult.keywordMatches
|
|
40
|
+
.filter(match => match.found)
|
|
41
|
+
.map(match => match.keyword);
|
|
42
|
+
generatedKeywords = foundKeywords.join('; ');
|
|
43
|
+
// Calculate match percentages
|
|
44
|
+
const keywordMatchCount = testCase.evaluationResult.keywordMatches.filter(m => m.found).length;
|
|
45
|
+
const totalKeywords = testCase.evaluationResult.keywordMatches.length;
|
|
46
|
+
keywordsMatch =
|
|
47
|
+
totalKeywords > 0 ? `${keywordMatchCount}/${totalKeywords}` : 'N/A';
|
|
48
|
+
}
|
|
49
|
+
const responseTime = testCase.responseTime
|
|
50
|
+
? (testCase.responseTime / 1000).toFixed(3)
|
|
51
|
+
: 'N/A';
|
|
52
|
+
const row = [
|
|
53
|
+
escapeCsvField(testCase.question),
|
|
54
|
+
escapeCsvField(expectedOutcome),
|
|
55
|
+
escapeCsvField(generatedKeywords),
|
|
56
|
+
keywordsMatch,
|
|
57
|
+
responseTime,
|
|
58
|
+
escapeCsvField(evaluationApproach),
|
|
59
|
+
escapeCsvField(evaluationScore),
|
|
60
|
+
];
|
|
61
|
+
csvRows.push(row.join(','));
|
|
62
|
+
});
|
|
63
|
+
return csvRows.join('\n');
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=test-results-csv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-results-csv.js","sourceRoot":"","sources":["../../../src/lib/import-export/test-results-csv.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACvE,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC;IAC1C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,SAAqB;IAC1D,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,iBAAiB;IACjB,MAAM,OAAO,GAAG;QACd,UAAU;QACV,mBAAmB;QACnB,oBAAoB;QACpB,gBAAgB;QAChB,mBAAmB;QACnB,qBAAqB;QACrB,kBAAkB;KACnB,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAEhC,gBAAgB;IAChB,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QAC3B,MAAM,eAAe,GAAG,QAAQ,CAAC,eAAe,IAAI,EAAE,CAAC;QAEvD,MAAM,kBAAkB,GAAG,QAAQ,CAAC,oBAAoB,EAAE,QAAQ,IAAI,EAAE,CAAC;QACzE,MAAM,KAAK,GAAG,QAAQ,CAAC,gBAAgB,EAAE,wBAAwB,EAAE,KAAK,CAAC;QACzE,MAAM,eAAe,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAEpE,IAAI,iBAAiB,GAAG,EAAE,CAAC;QAC3B,IAAI,aAAa,GAAG,EAAE,CAAC;QAEvB,IAAI,QAAQ,CAAC,gBAAgB,EAAE,CAAC;YAC9B,MAAM,aAAa,GAAG,QAAQ,CAAC,gBAAgB,CAAC,cAAc;iBAC3D,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;iBAC5B,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAE/B,iBAAiB,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAE7C,8BAA8B;YAC9B,MAAM,iBAAiB,GAAG,QAAQ,CAAC,gBAAgB,CAAC,cAAc,CAAC,MAAM,CACvE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CACb,CAAC,MAAM,CAAC;YACT,MAAM,aAAa,GAAG,QAAQ,CAAC,gBAAgB,CAAC,cAAc,CAAC,MAAM,CAAC;YAEtE,aAAa;gBACX,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,iBAAiB,IAAI,aAAa,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QACxE,CAAC;QAED,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY;YACxC,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YAC3C,CAAC,CAAC,KAAK,CAAC;QAEV,MAAM,GAAG,GAAG;YACV,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC;YACjC,cAAc,CAAC,eAAe,CAAC;YAC/B,cAAc,CAAC,iBAAiB,CAAC;YACjC,aAAa;YACb,YAAY;YACZ,cAAc,CAAC,kBAAkB,CAAC;YAClC,cAAc,CAAC,eAAe,CAAC;SAChC,CAAC;QAEF,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC","sourcesContent":["import { TestCase } from '../../types/llm-test-runner';\n\n/**\n * Escapes a CSV field by wrapping it in quotes if it contains special characters\n * @param field - The field to escape\n * @returns Escaped field string\n */\nexport function escapeCsvField(field: string): string {\n if (field.includes(',') || field.includes('\"') || field.includes('\\n')) {\n return `\"${field.replace(/\"/g, '\"\"')}\"`;\n }\n return field;\n}\n\n/**\n * Exports test results to a CSV string\n * @param testCases - Array of test cases with results to export\n * @returns CSV string representation of the test results\n */\nexport function exportTestResultsToCsv(testCases: TestCase[]): string {\n const csvRows: string[] = [];\n\n // Add header row\n const headers = [\n 'Question',\n 'Expected Keywords',\n 'Generated Keywords',\n 'Keywords Match',\n 'Response Time (s)',\n 'Evaluation Approach',\n 'Evaluation Score',\n ];\n csvRows.push(headers.join(','));\n\n // Add data rows\n testCases.forEach(testCase => {\n const expectedOutcome = testCase.expectedOutcome || '';\n\n const evaluationApproach = testCase.evaluationParameters?.approach || '';\n const score = testCase.evaluationResult?.evaluationApproachResult?.score;\n const evaluationScore = score !== undefined ? score.toString() : '';\n \n let generatedKeywords = '';\n let keywordsMatch = '';\n\n if (testCase.evaluationResult) {\n const foundKeywords = testCase.evaluationResult.keywordMatches\n .filter(match => match.found)\n .map(match => match.keyword);\n\n generatedKeywords = foundKeywords.join('; ');\n\n // Calculate match percentages\n const keywordMatchCount = testCase.evaluationResult.keywordMatches.filter(\n m => m.found,\n ).length;\n const totalKeywords = testCase.evaluationResult.keywordMatches.length;\n\n keywordsMatch =\n totalKeywords > 0 ? `${keywordMatchCount}/${totalKeywords}` : 'N/A';\n }\n\n const responseTime = testCase.responseTime\n ? (testCase.responseTime / 1000).toFixed(3)\n : 'N/A';\n\n const row = [\n escapeCsvField(testCase.question),\n escapeCsvField(expectedOutcome),\n escapeCsvField(generatedKeywords),\n keywordsMatch,\n responseTime,\n escapeCsvField(evaluationApproach),\n escapeCsvField(evaluationScore),\n ];\n\n csvRows.push(row.join(','));\n });\n\n return csvRows.join('\\n');\n}\n\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats test cases as a JSON string suitable for saving as a test suite
|
|
3
|
+
* @param testCases - Array of test cases to format
|
|
4
|
+
* @returns JSON string representation of the test suite
|
|
5
|
+
*/
|
|
6
|
+
export function formatTestSuiteAsJson(testCases) {
|
|
7
|
+
const exportData = testCases.map(testCase => ({
|
|
8
|
+
id: testCase.id,
|
|
9
|
+
question: testCase.question,
|
|
10
|
+
expectedOutcome: testCase.expectedOutcome,
|
|
11
|
+
evaluationParameters: testCase.evaluationParameters,
|
|
12
|
+
}));
|
|
13
|
+
return JSON.stringify(exportData, null, 2);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=test-suite-exporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-suite-exporter.js","sourceRoot":"","sources":["../../../src/lib/import-export/test-suite-exporter.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,SAAqB;IACzD,MAAM,UAAU,GAA0B,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACnE,EAAE,EAAE,QAAQ,CAAC,EAAE;QACf,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,eAAe,EAAE,QAAQ,CAAC,eAAe;QAEzC,oBAAoB,EAAE,QAAQ,CAAC,oBAAoB;KACpD,CAAC,CAAC,CAAC;IAEJ,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import { TestCase } from '../../types/llm-test-runner';\n\nexport interface TestSuiteExportData {\n id: string;\n question: string;\n expectedOutcome: string;\n evaluationParameters?: {\n approach: string;\n threshold?: number;\n };\n}\n\n/**\n * Formats test cases as a JSON string suitable for saving as a test suite\n * @param testCases - Array of test cases to format\n * @returns JSON string representation of the test suite\n */\nexport function formatTestSuiteAsJson(testCases: TestCase[]): string {\n const exportData: TestSuiteExportData[] = testCases.map(testCase => ({\n id: testCase.id,\n question: testCase.question,\n expectedOutcome: testCase.expectedOutcome,\n\n evaluationParameters: testCase.evaluationParameters,\n }));\n\n return JSON.stringify(exportData, null, 2);\n}\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createTestCaseFromImport } from "../test-cases/test-case-factory";
|
|
2
|
+
/**
|
|
3
|
+
* Validates and imports test cases from JSON content
|
|
4
|
+
* @param jsonContent - The JSON string to parse and validate
|
|
5
|
+
* @returns Validation result with test cases or error message
|
|
6
|
+
*/
|
|
7
|
+
export function importTestSuite(jsonContent) {
|
|
8
|
+
try {
|
|
9
|
+
const parsed = JSON.parse(jsonContent);
|
|
10
|
+
if (!Array.isArray(parsed)) {
|
|
11
|
+
return {
|
|
12
|
+
success: false,
|
|
13
|
+
error: 'Invalid JSON structure. Expected a JSON array.',
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
if (parsed.length === 0) {
|
|
17
|
+
return {
|
|
18
|
+
success: false,
|
|
19
|
+
error: 'The test suite is empty. Please provide at least one test case.',
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const testCases = parsed.map((item, index) => {
|
|
23
|
+
try {
|
|
24
|
+
return createTestCaseFromImport(item);
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
throw new Error(`Invalid test case at index ${index}: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
success: true,
|
|
32
|
+
testCases,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
return {
|
|
37
|
+
success: false,
|
|
38
|
+
error: err instanceof Error
|
|
39
|
+
? err.message
|
|
40
|
+
: 'Error processing file. Please ensure it is a valid JSON array.',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=test-suite-importer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-suite-importer.js","sourceRoot":"","sources":["../../../src/lib/import-export/test-suite-importer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAQ3E;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,WAAmB;IACjD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAEvC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC3B,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,gDAAgD;aACxD,CAAC;QACJ,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,iEAAiE;aACzE,CAAC;QACJ,CAAC;QAED,MAAM,SAAS,GAAe,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACvD,IAAI,CAAC;gBACH,OAAO,wBAAwB,CAAC,IAAI,CAAC,CAAC;YACxC,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,IAAI,KAAK,CACb,8BAA8B,KAAK,KAAK,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAC/F,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE,IAAI;YACb,SAAS;SACV,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EACH,GAAG,YAAY,KAAK;gBAClB,CAAC,CAAC,GAAG,CAAC,OAAO;gBACb,CAAC,CAAC,gEAAgE;SACvE,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import { TestCase } from '../../types/llm-test-runner';\nimport { createTestCaseFromImport } from '../test-cases/test-case-factory';\n\nexport interface ImportValidationResult {\n success: boolean;\n testCases?: TestCase[];\n error?: string;\n}\n\n/**\n * Validates and imports test cases from JSON content\n * @param jsonContent - The JSON string to parse and validate\n * @returns Validation result with test cases or error message\n */\nexport function importTestSuite(jsonContent: string): ImportValidationResult {\n try {\n const parsed = JSON.parse(jsonContent);\n\n if (!Array.isArray(parsed)) {\n return {\n success: false,\n error: 'Invalid JSON structure. Expected a JSON array.',\n };\n }\n\n if (parsed.length === 0) {\n return {\n success: false,\n error: 'The test suite is empty. Please provide at least one test case.',\n };\n }\n\n const testCases: TestCase[] = parsed.map((item, index) => {\n try {\n return createTestCaseFromImport(item);\n } catch (err) {\n throw new Error(\n `Invalid test case at index ${index}: ${err instanceof Error ? err.message : 'Unknown error'}`,\n );\n }\n });\n\n return {\n success: true,\n testCases,\n };\n } catch (err) {\n return {\n success: false,\n error:\n err instanceof Error\n ? err.message\n : 'Error processing file. Please ensure it is a valid JSON array.',\n };\n }\n}\n\n"]}
|