mirror of
https://github.com/samiyev/puaros.git
synced 2025-12-27 23:06:54 +05:00
feat(ipuaro): add session configuration
- Add SessionConfigSchema with persistIndefinitely, maxHistoryMessages, saveInputHistory - Implement Session.truncateHistory() method for limiting message history - Update HandleMessage to support history truncation and input history toggle - Add config flow through useSession and App components - Add 19 unit tests for SessionConfigSchema - Update CHANGELOG.md and ROADMAP.md for v0.22.2
This commit is contained in:
@@ -123,8 +123,7 @@ describe("OllamaClient", () => {
|
||||
mockOllamaInstance.chat.mockResolvedValue({
|
||||
message: {
|
||||
role: "assistant",
|
||||
content:
|
||||
'<tool_call name="get_lines"><path>src/index.ts</path></tool_call>',
|
||||
content: '<tool_call name="get_lines"><path>src/index.ts</path></tool_call>',
|
||||
tool_calls: undefined,
|
||||
},
|
||||
eval_count: 30,
|
||||
@@ -408,7 +407,6 @@ describe("OllamaClient", () => {
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
describe("error handling", () => {
|
||||
it("should handle ECONNREFUSED errors", async () => {
|
||||
mockOllamaInstance.chat.mockRejectedValue(new Error("ECONNREFUSED"))
|
||||
@@ -435,7 +433,9 @@ describe("OllamaClient", () => {
|
||||
|
||||
const client = new OllamaClient(defaultConfig)
|
||||
|
||||
await expect(client.chat([createUserMessage("Hello")])).rejects.toThrow(/Request was aborted/)
|
||||
await expect(client.chat([createUserMessage("Hello")])).rejects.toThrow(
|
||||
/Request was aborted/,
|
||||
)
|
||||
})
|
||||
|
||||
it("should handle model not found errors", async () => {
|
||||
@@ -443,7 +443,9 @@ describe("OllamaClient", () => {
|
||||
|
||||
const client = new OllamaClient(defaultConfig)
|
||||
|
||||
await expect(client.chat([createUserMessage("Hello")])).rejects.toThrow(/Model.*not found/)
|
||||
await expect(client.chat([createUserMessage("Hello")])).rejects.toThrow(
|
||||
/Model.*not found/,
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -303,7 +303,9 @@ describe("GetFunctionTool", () => {
|
||||
})
|
||||
|
||||
it("should handle error when reading lines fails", async () => {
|
||||
const ast = createMockAST([createMockFunction({ name: "test", lineStart: 1, lineEnd: 1 })])
|
||||
const ast = createMockAST([
|
||||
createMockFunction({ name: "test", lineStart: 1, lineEnd: 1 }),
|
||||
])
|
||||
const storage: IStorage = {
|
||||
getFile: vi.fn().mockResolvedValue(null),
|
||||
getAST: vi.fn().mockResolvedValue(ast),
|
||||
|
||||
Reference in New Issue
Block a user