Skip to content
Open
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
23 changes: 23 additions & 0 deletions chainforge/react-server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions chainforge/react-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"dayjs": "^1.11.8",
"emoji-mart": "^5.5.2",
"emoji-picker-react": "^4.4.9",
"file-saver": "^2.0.5",
"google-auth-library": "^8.8.0",
"https-browserify": "^1.0.0",
"jstat": "^1.9.6",
Expand Down Expand Up @@ -135,6 +136,8 @@
},
"devDependencies": {
"@craco/craco": "^7.1.0",
"@types/file-saver": "^2.0.7",
"@types/js-yaml": "^4.0.9",
"@types/lodash": "^4.17.0",
"@types/markdown-it": "^14.1.2",
"@types/papaparse": "^5.3.14",
Expand Down
23 changes: 23 additions & 0 deletions chainforge/react-server/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ import NestedMenu, { NestedMenuItemProps } from "./NestedMenu";
import RequestClarificationModal, {
RequestClarificationModalProps,
} from "./RequestClarificationModal";
import { jsontoYml } from "./backend/jsonToYml";

const IS_ACCEPTED_BROWSER =
(isChrome ||
Expand Down Expand Up @@ -655,6 +656,17 @@ const App = () => {
URL.revokeObjectURL(downloadLink.href);
};

const exportYml = useCallback(
async (flowData?: unknown) => {
if (!rfInstance && !flowData) return;
// We first get the data of the flow, if we haven't already
const flow = flowData ?? rfInstance?.toObject();
if (!flow) return;
await jsontoYml(JSON.stringify(flow), flowFileName, 0, 1, handleError);
},
[rfInstance, flowFileName],
);

// Export flow to JSON
const exportFlow = useCallback(
(
Expand Down Expand Up @@ -1562,6 +1574,17 @@ const App = () => {
>
Export
</Button>
<Button
onClick={() => exportYml()}
size="sm"
variant="outline"
color={colorScheme === "light" ? "blue" : "gray"}
bg={colorScheme === "light" ? "#eee" : "#222"}
compact
mr="xs"
>
Export YML
</Button>
<Button
onClick={importFlowFromFile}
size="sm"
Expand Down
4 changes: 2 additions & 2 deletions chainforge/react-server/src/LLMEvalNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const OUTPUT_FORMATS = [
{ value: OutputFormat.Num, label: "numeric" },
{ value: OutputFormat.Any, label: "open-ended" },
];
const OUTPUT_FORMAT_PROMPTS = {
export const OUTPUT_FORMAT_PROMPTS = {
[OutputFormat.Bin]:
"Only reply with boolean values true or false, nothing else.",
[OutputFormat.Cat]: "Only reply with your categorization, nothing else.",
Expand All @@ -75,7 +75,7 @@ const OUTPUT_FORMAT_PROMPTS = {
[OutputFormat.Any]: "",
};

const OUTPUT_FORMAT_PROMPTS_REASONING = {
export const OUTPUT_FORMAT_PROMPTS_REASONING = {
[OutputFormat.Bin]:
"First, explain your reasoning for the classification. Then, output your final answer in the following format on a new line: SCORE: true or SCORE: false",
[OutputFormat.Cat]:
Expand Down
2 changes: 1 addition & 1 deletion chainforge/react-server/src/SimpleEvalNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const OPERATORS: Operator[] = [
"appears in",
];

const createJSEvalCodeFor = (
export const createJSEvalCodeFor = (
responseFormat: ResponseFormat,
operation: Operator,
value: string,
Expand Down
Loading
Loading