mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 10:23:14 +00:00
Harrison changes (#21)
* cr * cr --------- Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
This commit is contained in:
parent
c6d867e1a7
commit
64e0e2e0d7
2 changed files with 13 additions and 9 deletions
|
|
@ -16,15 +16,14 @@ async function runE2E() {
|
|||
const threadId = uuidv4();
|
||||
|
||||
const userRequest =
|
||||
"This repo contains the react/next.js code for my persona/portfolio site. It currently has static values set for the number of stars on the repositories I highlight. I want this to be accurate, but I do NOT want it to make requests to GitHub every time a user visits. Instead, please implement a solution which will run once a day, fetch the number of stars from a list of repos, then write them to vercel's KV store. Finally, update the UI to make a request to the KV store when the user visits my page and render the accurate star counts.";
|
||||
|
||||
"The system message contains a REPO_DIRECTORY variable. But nothing is formatted in that variable. Please make sure to format the REPO_DIRECTORY variable in the system message. You will probably want to move the repo directory info from config to the State.";
|
||||
const configurable: Omit<
|
||||
GraphConfig["configurable"],
|
||||
"thread_id" | "assistant_id"
|
||||
> = {
|
||||
target_repository: {
|
||||
owner: "bracesproul",
|
||||
repo: "personal-site",
|
||||
owner: "langchain-ai",
|
||||
repo: "open-swe",
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -67,8 +66,8 @@ async function resumeGraph(threadId: string) {
|
|||
"thread_id" | "assistant_id"
|
||||
> = {
|
||||
target_repository: {
|
||||
owner: "bracesproul",
|
||||
repo: "personal-site",
|
||||
owner: "langchain-ai",
|
||||
repo: "open-swe",
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { GraphState, GraphConfig, GraphUpdate, PlanItem } from "../types.js";
|
||||
import { loadModel, Task } from "../utils/load-model.js";
|
||||
import { shellTool, applyPatchTool } from "../tools/index.js";
|
||||
import { getRepoAbsolutePath } from "../utils/git/index.js";
|
||||
import { formatPlanPrompt } from "../utils/plan-prompt.js";
|
||||
import { pauseSandbox } from "../utils/sandbox.js";
|
||||
import { createLogger, LogLevel } from "../utils/logger.js";
|
||||
|
|
@ -70,10 +71,14 @@ You MUST adhere to the following criteria when executing the task:
|
|||
- Do NOT show the full contents of large files you have already written, unless the user explicitly asks for them.
|
||||
- Always use \`rg\` instead of \`grep/ls -R\` because it is much faster and respects gitignore.
|
||||
- Always use glob patterns when searching with \`rg\` for specific file types. For example, to search for all TSX files, use \`rg -i star -g **/*.tsx project-directory/\`. This is because \`rg\` does not have built in file types for every language.
|
||||
- Only make changes to the existing Git repo ({REPO_DIRECTORY}). Any changes outside this repo will not be detected, so do not attempt to create new files or directories outside of this repo.
|
||||
`;
|
||||
|
||||
const formatPrompt = (plan: PlanItem[]): string => {
|
||||
return systemPrompt.replace("{PLAN_PROMPT}", formatPlanPrompt(plan));
|
||||
const formatPrompt = (plan: PlanItem[], config: GraphConfig): string => {
|
||||
const repoDirectory = getRepoAbsolutePath(config);
|
||||
return systemPrompt
|
||||
.replace("{PLAN_PROMPT}", formatPlanPrompt(plan))
|
||||
.replaceAll("{REPO_DIRECTORY}", repoDirectory);
|
||||
};
|
||||
|
||||
export async function generateAction(
|
||||
|
|
@ -87,7 +92,7 @@ export async function generateAction(
|
|||
const response = await modelWithTools.invoke([
|
||||
{
|
||||
role: "system",
|
||||
content: formatPrompt(state.plan),
|
||||
content: formatPrompt(state.plan, config),
|
||||
},
|
||||
...state.messages,
|
||||
]);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue