Skip to content

Commit

Permalink
Use contents in context (DavidSouther#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSouther authored May 6, 2024
1 parent ba277eb commit c0cb411
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 0 additions & 1 deletion cli/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export async function loadFs(fs, args) {
const root = resolve(args.values.root ?? '.');
fs.cd(root);


const settings = await ailly.Ailly.makePipelineSettings({
root,
out: resolve(args.values.out ?? root),
Expand Down
1 change: 0 additions & 1 deletion cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import * as ailly from "@ailly/core";
import { makeArgs, help } from "./args.js";
import { loadFs, LOGGER } from "./fs.js";
import { version } from "./version.js";
import { promisify } from "node:util";

await main();

Expand Down
14 changes: 13 additions & 1 deletion core/src/engine/bedrock/bedrock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ export async function generate(
if (c.context.edit) {
const lang = c.context.edit.file.split(".").at(-1) ?? "";
fence = "```" + lang;
const { start, end } = c.context.edit as { start?: number; end?: number };
if (start != undefined) {
if (messages.at(-1)?.role === "user") {
messages.at(-1)!.content += [
"",
"You are replacing this section:",
"```",
c.meta?.text?.split("\n").slice(start, end),
"```",
].join("\n");
}
}
messages.push({ role: "assistant", content: fence });
stopSequences = ["```"];
}
Expand Down Expand Up @@ -176,7 +188,7 @@ export function getMessagesFolder(
(content.context.folder ?? [])
.map((c) => context[c])
.map<string>(
(c) => `<file name="${c.name}>\n${c.prompt ?? c.response ?? ""}</file>`
(c) => `<file name="${c.name}>\n${c.meta?.text ?? c.prompt + "\n" + c.response}</file>`
)
.join("\n") +
"\n</folder>";
Expand Down

0 comments on commit c0cb411

Please sign in to comment.