mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 14:22:27 +00:00
OpenTUI is here (#2685)
This commit is contained in:
@@ -119,6 +119,7 @@ export namespace SessionCompaction {
|
||||
cwd: Instance.directory,
|
||||
root: Instance.worktree,
|
||||
},
|
||||
summary: true,
|
||||
cost: 0,
|
||||
tokens: {
|
||||
output: 0,
|
||||
|
||||
@@ -182,6 +182,8 @@ export namespace MessageV2 {
|
||||
export const ToolStatePending = z
|
||||
.object({
|
||||
status: z.literal("pending"),
|
||||
input: z.record(z.string(), z.any()),
|
||||
raw: z.string(),
|
||||
})
|
||||
.meta({
|
||||
ref: "ToolStatePending",
|
||||
@@ -192,7 +194,7 @@ export namespace MessageV2 {
|
||||
export const ToolStateRunning = z
|
||||
.object({
|
||||
status: z.literal("running"),
|
||||
input: z.any(),
|
||||
input: z.record(z.string(), z.any()),
|
||||
title: z.string().optional(),
|
||||
metadata: z.record(z.string(), z.any()).optional(),
|
||||
time: z.object({
|
||||
@@ -433,6 +435,8 @@ export namespace MessageV2 {
|
||||
if (part.toolInvocation.state === "partial-call") {
|
||||
return {
|
||||
status: "pending",
|
||||
input: {},
|
||||
raw: "",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1054,6 +1054,8 @@ export namespace SessionPrompt {
|
||||
callID: value.id,
|
||||
state: {
|
||||
status: "pending",
|
||||
input: {},
|
||||
raw: "",
|
||||
},
|
||||
})
|
||||
toolcalls[value.id] = part as MessageV2.ToolPart
|
||||
@@ -1302,16 +1304,16 @@ export namespace SessionPrompt {
|
||||
part.state.status !== "completed" &&
|
||||
part.state.status !== "error"
|
||||
) {
|
||||
Session.updatePart({
|
||||
await Session.updatePart({
|
||||
...part,
|
||||
state: {
|
||||
...part.state,
|
||||
status: "error",
|
||||
error: "Tool execution aborted",
|
||||
time: {
|
||||
start: Date.now(),
|
||||
end: Date.now(),
|
||||
},
|
||||
input: {},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -1815,6 +1817,12 @@ export namespace SessionPrompt {
|
||||
content: x,
|
||||
}),
|
||||
),
|
||||
{
|
||||
role: "user" as const,
|
||||
content: `
|
||||
The following is the text to summarize:
|
||||
`,
|
||||
},
|
||||
...MessageV2.toModelMessage([
|
||||
{
|
||||
info: {
|
||||
|
||||
@@ -81,10 +81,15 @@ export namespace SessionSummary {
|
||||
),
|
||||
{
|
||||
role: "user" as const,
|
||||
content: textPart?.text ?? "",
|
||||
content: `
|
||||
The following is the text to summarize:
|
||||
<text>
|
||||
${textPart?.text ?? ""}
|
||||
</text>
|
||||
`,
|
||||
},
|
||||
],
|
||||
headers:small.info.headers,
|
||||
headers: small.info.headers,
|
||||
model: small.language,
|
||||
})
|
||||
log.info("title", { title: result.text })
|
||||
@@ -117,9 +122,9 @@ export namespace SessionSummary {
|
||||
`,
|
||||
},
|
||||
],
|
||||
headers: small.info.headers
|
||||
})
|
||||
summary = result.text
|
||||
headers: small.info.headers,
|
||||
}).catch(() => {})
|
||||
if (result) summary = result.text
|
||||
}
|
||||
userMsg.summary.body = summary
|
||||
log.info("body", { body: summary })
|
||||
|
||||
@@ -108,7 +108,8 @@ export namespace SystemPrompt {
|
||||
const found = Array.from(paths).map((p) =>
|
||||
Bun.file(p)
|
||||
.text()
|
||||
.catch(() => ""),
|
||||
.catch(() => "")
|
||||
.then((x) => "Instructions from: " + p + "\n" + x),
|
||||
)
|
||||
return Promise.all(found).then((result) => result.filter(Boolean))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user