Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
7278de7
wip: thread stream.
MarcMcIntosh Nov 4, 2024
fe3acea
wip(chat-db): add middleware to connect to db and get threads.
MarcMcIntosh Nov 5, 2024
7031036
chore: resync with alpha
MarcMcIntosh Jan 8, 2025
05d7b67
wip(knowledge): add sub end point.
MarcMcIntosh Jan 9, 2025
7f0703e
wip(knowlage db): handle insert, update and delete operations.
MarcMcIntosh Jan 9, 2025
f0442d4
wip(memories): add a basic ui for rendering memories.
MarcMcIntosh Jan 9, 2025
9337697
wip(knowledge): add create, delete and search services.
MarcMcIntosh Jan 9, 2025
9183000
wip(knowledge): add url for updating usage.
MarcMcIntosh Jan 9, 2025
7f7cc2e
wip(knowledge): add the knowledge page to the sidebar.
MarcMcIntosh Jan 10, 2025
1b5110f
wip(knowledge): add a basic form for adding knowledge.
MarcMcIntosh Jan 10, 2025
2dbbee7
wip(knowledge form): add back button.
MarcMcIntosh Jan 10, 2025
eac844e
wip(knowledge): add back in listAll and add a scroll area to memories…
MarcMcIntosh Jan 10, 2025
311814b
wip(knowledge): list all and subscribe
MarcMcIntosh Jan 10, 2025
7ff7b81
wip(knowledge): add delete functionality.
MarcMcIntosh Jan 10, 2025
3584b7f
ui(knowledge): change the orientation of the data-list depending on size
MarcMcIntosh Jan 10, 2025
1a524d9
wip(knowledge list): remove properties the user doesn't need to see f…
MarcMcIntosh Jan 13, 2025
deb688d
ui(knowledge list): remove data list and use `m_goal` as the title an…
MarcMcIntosh Jan 13, 2025
edfba67
feat(knowledge): add a like button.
MarcMcIntosh Jan 13, 2025
702da23
ui(thumb): change like button from tick to thumb.
MarcMcIntosh Jan 13, 2025
0d1b99c
refactor(knowledge): remove project, type and origin from add knowled…
MarcMcIntosh Jan 13, 2025
0e115c3
refactor(knowledge): remove `mem-list` endpoint.
MarcMcIntosh Jan 14, 2025
821dd6b
feat(knowledge): hide behind a feature flag.
MarcMcIntosh Jan 14, 2025
8b04e47
feat(feature menu): add a hidden feature menu.
MarcMcIntosh Jan 14, 2025
43084de
wip(knowledge): add the ability to edit knowledge.
MarcMcIntosh Jan 14, 2025
ff08157
fix(feature menu): only allow the code to be entered when nothing if …
MarcMcIntosh Jan 14, 2025
1ab303e
wip(knowledge search): add comments and rough search handler
MarcMcIntosh Jan 16, 2025
1583517
feat(knowledge): add quick search and fix features usage
MarcMcIntosh Jan 16, 2025
068fe52
fix(features): add links to setting for features set in settings.
MarcMcIntosh Jan 16, 2025
531550e
chore*knowledge): fix linter warnings
MarcMcIntosh Jan 16, 2025
f2d8f1b
wip(knowledge): add `mem-upd` handler for updating memroies.
MarcMcIntosh Jan 20, 2025
dab9ece
wip(knowledge): add status to subscription payload.
MarcMcIntosh Jan 20, 2025
e043f90
wip(knowledge): add vectorisation status information.
MarcMcIntosh Jan 21, 2025
a0ffbbd
wip(knowledge): animate db button while parsing.
MarcMcIntosh Jan 21, 2025
f9a570c
wip(knowledge): debouce search and cache vecdb status.
MarcMcIntosh Jan 22, 2025
35eb0b3
refactor(knowledge): move components to separate files.
MarcMcIntosh Jan 22, 2025
83ccc49
ui(knowledge): add titles to the forms.
MarcMcIntosh Jan 22, 2025
997c6c6
ui(knowledge): add padding to items so the scroll bar isn't over the …
MarcMcIntosh Jan 22, 2025
d934e36
linter: allow log for unsupproted type in knowledge stream.
MarcMcIntosh Jan 22, 2025
7f6c064
fix(knowledge): don't wait for consumeStream to resolve, this allows …
MarcMcIntosh Jan 23, 2025
7496752
feat(knowledge): create knowledge from chat.
MarcMcIntosh Jan 23, 2025
76766e3
wip(knowledge): add a reducer and event listener for the current proj…
MarcMcIntosh Jan 23, 2025
e4660ad
wip(knowledge): export active_project types for vscode.
MarcMcIntosh Jan 24, 2025
f741ef7
fix(knowledge): if the chat is an integration use the project from th…
MarcMcIntosh Jan 27, 2025
8390c47
wip(knowledge): add a story with a knowledge tool call.
MarcMcIntosh Jan 27, 2025
82b73f5
wip(knowledge): add basic ui for updating knowledge useage.
MarcMcIntosh Jan 27, 2025
d8cf579
fix(knowledge): hang up on unmount.
MarcMcIntosh Jan 28, 2025
c481a9c
wip(knowledge): move subscribe to a thunk so it can hangup requests.
MarcMcIntosh Jan 28, 2025
6398676
wip(chat-db): add knowledge sub thunk.
MarcMcIntosh Jan 31, 2025
eacf064
fix: clear memery when make a new request
MarcMcIntosh Feb 3, 2025
a8b5686
wip(knowledge): move search to a thunk.
MarcMcIntosh Feb 3, 2025
e1babb9
Merge branch 'alpha' into chat-db
MarcMcIntosh Feb 3, 2025
4cbb6e8
refactor: remove old chat-db code.
MarcMcIntosh Feb 3, 2025
142b2b1
ui(knowledge): move like button to bottom of last assistant message.
MarcMcIntosh Feb 4, 2025
04b1858
wip(knowledge): make tool button look nicer.
MarcMcIntosh Feb 5, 2025
27a22c7
wip(knowledge): add spacing around tool content.
MarcMcIntosh Feb 5, 2025
c86c17b
wip(knowledge): add msw handler for updating usage.
MarcMcIntosh Feb 5, 2025
b005b56
Merge branch 'alpha' into chat-db
MarcMcIntosh Feb 5, 2025
fdbaaf7
Merge branch 'alpha' into chat-db
MarcMcIntosh Feb 7, 2025
942a4d9
ui(like button): disable while loading and fix the title.
MarcMcIntosh Feb 10, 2025
b2d8fcf
ui(knowledge): hide ui changes to knowledge tool if the feature is no…
MarcMcIntosh Feb 10, 2025
a45299a
refactor(knowledge): reset form on success.
MarcMcIntosh Feb 10, 2025
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
570 changes: 570 additions & 0 deletions src/__fixtures__/chat.ts

Large diffs are not rendered by default.

260 changes: 260 additions & 0 deletions src/__fixtures__/knowledge.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
import { MemdbSubEvent, MemoRecord, VecDbStatus } from "../events";

export const STUB_MEMORIES: MemoRecord[] = [
{
memid: "7666487b81",
m_type: "proj-fact",
m_goal: "compile",
m_project: "proj1",
m_payload: "Looks like proj1 is written in fact in Rust.",
m_origin: "local-committed",
mstat_correct: 1,
mstat_relevant: -1,
mstat_times_used: 1,
},
{
memid: "cdec854819",
m_type: "seq-of-acts",
m_goal: "compile",
m_project: "proj2",
m_payload: "Wow, running cargo build on proj2 was successful!",
m_origin: "local-committed",
mstat_correct: 0,
mstat_relevant: 0,
mstat_times_used: 0,
},
{
memid: "eb1d64684b",
m_type: "proj-fact",
m_goal: "compile",
m_project: "proj2",
m_payload: "Looks like proj2 is written in fact in Rust.",
m_origin: "local-committed",
mstat_correct: 0,
mstat_relevant: 0,
mstat_times_used: 0,
},

{
memid: "eb1d64684c",
m_type: "proj-fact",
m_goal:
"Long goal Long goal Long goal Long goal Long goal Long goal Long goal Long goal Long goal Long goal",
m_project: "proj2",
m_payload: "Looks like proj2 is written in fact in Rust.",
m_origin: "local-committed",
mstat_correct: 0,
mstat_relevant: 0,
mstat_times_used: 0,
},
];

export const STUB_SUB_RESPONSE: MemdbSubEvent[] = [
{
pubevent_id: 19,
pubevent_action: "INSERT",
pubevent_json: {
memid: "66a072d699",
m_type: "seq-of-acts",
m_goal: "compile",
m_project: "proj1",
m_payload: "Wow, running cargo build on proj1 was successful!",
m_origin: "local-committed",
mstat_correct: 0.0,
mstat_relevant: 0.0,
mstat_times_used: 0,
},
},
{
pubevent_id: 26,
pubevent_action: "INSERT",
pubevent_json: {
memid: "d688925823",
m_type: "proj-fact",
m_goal: "compile",
m_project: "proj1",
m_payload: "Looks like proj1 is written in fact in Rust.",
m_origin: "local-committed",
mstat_correct: 0.0,
mstat_relevant: 0.0,
mstat_times_used: 0,
},
},
{
pubevent_id: 27,
pubevent_action: "INSERT",
pubevent_json: {
memid: "08f9374753",
m_type: "seq-of-acts",
m_goal: "compile",
m_project: "proj2",
m_payload: "Wow, running cargo build on proj2 was successful!",
m_origin: "local-committed",
mstat_correct: 0.0,
mstat_relevant: 0.0,
mstat_times_used: 0,
},
},
{
pubevent_id: 28,
pubevent_action: "INSERT",
pubevent_json: {
memid: "c9cefe3ff4",
m_type: "proj-fact",
m_goal: "compile",
m_project: "proj2",
m_payload: "Looks like proj2 is written in fact in Rust.",
m_origin: "local-committed",
mstat_correct: 0.0,
mstat_relevant: 0.0,
mstat_times_used: 0,
},
},
{
pubevent_id: 29,
pubevent_action: "UPDATE",
pubevent_json: {
memid: "d688925823",
m_type: "proj-fact",
m_goal: "compile",
m_project: "proj1",
m_payload: "Looks like proj1 is written in fact in Rust.",
m_origin: "local-committed",
mstat_correct: 1.0,
mstat_relevant: -1.0,
mstat_times_used: 1,
},
},
{
pubevent_id: 30,
pubevent_action: "DELETE",
pubevent_json: {
memid: "9d2a679b09",
m_type: "",
m_goal: "",
m_project: "",
m_payload: "",
m_origin: "",
mstat_correct: 0,
mstat_relevant: 0,
mstat_times_used: 0,
},
},
];

// export const STUB_SUB_RESPONSE_WITH_STATUS: (
// | MemdbSubEventUnparsed
// | VecDbStatus
// )[] = [];

export const VECDB_STATUS_STARTING: VecDbStatus = {
files_unprocessed: 0,
files_total: 0,
requests_made_since_start: 1,
vectors_made_since_start: 33,
db_size: 33,
db_cache_size: 37,
state: "starting",
queue_additions: false,
vecdb_max_files_hit: false,
vecdb_errors: {},
};

export const VECDB_STATUS_PARSING: VecDbStatus = {
files_unprocessed: 377,
files_total: 404,
requests_made_since_start: 5,
vectors_made_since_start: 296,
db_size: 168,
db_cache_size: 333,
state: "parsing",
queue_additions: false,
vecdb_max_files_hit: false,
vecdb_errors: {},
};

export const VECDB_STATUS_PARSING_2: VecDbStatus = {
files_unprocessed: 372,
files_total: 404,
requests_made_since_start: 6,
vectors_made_since_start: 303,
db_size: 303,
db_cache_size: 340,
state: "parsing",
queue_additions: false,
vecdb_max_files_hit: false,
vecdb_errors: {},
};

export const VECDV_STATUS_PARISING_3: VecDbStatus = {
files_unprocessed: 192,
files_total: 404,
requests_made_since_start: 21,
vectors_made_since_start: 990,
db_size: 1021,
db_cache_size: 1027,
state: "parsing",
queue_additions: false,
vecdb_max_files_hit: false,
vecdb_errors: {},
};

export const VECDB_STATUS_PARSING_4: VecDbStatus = {
files_unprocessed: 12,
files_total: 404,
requests_made_since_start: 52,
vectors_made_since_start: 2494,
db_size: 2524,
db_cache_size: 2531,
state: "parsing",
queue_additions: false,
vecdb_max_files_hit: false,
vecdb_errors: {},
};

export const VECDB_STATUS_COOLDOWN: VecDbStatus = {
files_unprocessed: 1,
files_total: 404,
requests_made_since_start: 52,
vectors_made_since_start: 2494,
db_size: 2524,
db_cache_size: 2533,
state: "cooldown",
queue_additions: false,
vecdb_max_files_hit: false,
vecdb_errors: {},
};

export const VECDB_STATUS_DONE: VecDbStatus = {
files_unprocessed: 0,
files_total: 0,
requests_made_since_start: 54,
vectors_made_since_start: 2535,
db_size: 2629,
db_cache_size: 2574,
state: "done",
queue_additions: false,
vecdb_max_files_hit: false,
vecdb_errors: {},
};

export const STUB_SUB_RESPONSE_WITH_STATUS = [
VECDB_STATUS_STARTING,
// ...STUB_SUB_RESPONSE,
VECDB_STATUS_PARSING,
VECDB_STATUS_PARSING_2,
VECDV_STATUS_PARISING_3,
VECDB_STATUS_PARSING_4,
VECDB_STATUS_COOLDOWN,
VECDB_STATUS_DONE,
];

export const STB_LOADING_VECDB = {
VECDB_STATUS_STARTING,
VECDB_STATUS_PARSING,
VECDB_STATUS_PARSING_2,
VECDV_STATUS_PARISING_3,
VECDB_STATUS_PARSING_4,
VECDB_STATUS_COOLDOWN,
VECDB_STATUS_DONE,
};
99 changes: 99 additions & 0 deletions src/__fixtures__/msw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ import { STUB_LINKS_FOR_CHAT_RESPONSE } from "./chat_links_response";
import {
AT_TOOLS_AVAILABLE_URL,
CHAT_LINKS_URL,
KNOWLEDGE_CREATE_URL,
KNOWLEDGE_SUB_URL,
KNOWLEDGE_UPDATE_USED_URL,
} from "../services/refact/consts";
import { STUB_TOOL_RESPONSE } from "./tools_response";
import { STUB_SUB_RESPONSE, STUB_SUB_RESPONSE_WITH_STATUS } from "./knowledge";
import { GoodPollingResponse } from "../services/smallcloud";
import type { LinksForChatResponse } from "../services/refact/links";
import { CompressTrajectoryResponse } from "../services/refact/knowledge";

export const goodPing: HttpHandler = http.get(
"http://127.0.0.1:8001/v1/ping",
Expand Down Expand Up @@ -103,13 +109,106 @@ export const chatLinks: HttpHandler = http.post(
},
);

export const noChatLinks: HttpHandler = http.post(
`http://127.0.0.1:8001${CHAT_LINKS_URL}`,
() => {
const res: LinksForChatResponse = {
uncommited_changes_warning: "",
links: [],
};
return HttpResponse.json(res);
},
);

export const goodTools: HttpHandler = http.get(
`http://127.0.0.1:8001${AT_TOOLS_AVAILABLE_URL}`,
() => {
return HttpResponse.json(STUB_TOOL_RESPONSE);
},
);

export const knowLedgeLoading: HttpHandler = http.post(
`http://127.0.0.1:8001${KNOWLEDGE_SUB_URL}`,
async () => {
const encoder = new TextEncoder();
const stream = new ReadableStream({
start(controller) {
// Encode the string chunks using "TextEncoder".
STUB_SUB_RESPONSE.forEach((item) => {
const str = `data: ${JSON.stringify(item)}\n\n`;
controller.enqueue(encoder.encode(str));
});

controller.close();
},
});

await new Promise((resolve) => setTimeout(resolve, 3000));

return new HttpResponse(stream, {
headers: {
"Content-Type": "text/plain",
},
});
},
);

export const KnowledgeWithStatus: HttpHandler = http.post(
`http://127.0.0.1:8001${KNOWLEDGE_SUB_URL}`,
() => {
const encoder = new TextEncoder();
const stream = new ReadableStream({
async start(controller) {
// Encode the string chunks using "TextEncoder".
for (const item of STUB_SUB_RESPONSE_WITH_STATUS) {
const str = `data: ${JSON.stringify(item)}\n\n`;
controller.enqueue(encoder.encode(str));
await new Promise((resolve) => setTimeout(resolve, 3000)); // 1-second delay
}

controller.close();
},
});

return new HttpResponse(stream, {
headers: {
"Content-Type": "text/plain",
},
});
},
);

export const makeKnowledgeFromChat: HttpHandler = http.post(
`http://127.0.0.1:8001${KNOWLEDGE_CREATE_URL}`,
() => {
const result: CompressTrajectoryResponse = {
memid: "foo",
trajectory: "something",
};
return HttpResponse.json(result);
},
);

export const updateKnowledgeUse: HttpHandler = http.post(
`http://127.0.0.1:8001${KNOWLEDGE_UPDATE_USED_URL}`,
async (ctx) => {
const body = await ctx.request.json();
const memid =
body &&
typeof body === "object" &&
"memid" in body &&
typeof body.memid === "string"
? body.memid
: "foo";
const result: CompressTrajectoryResponse = {
memid,
trajectory: "something",
};

await new Promise((r) => setTimeout(r, 1000));
return HttpResponse.json(result);
},
);
export const loginPollingGood: HttpHandler = http.get(
"https://www.smallcloud.ai/v1/streamlined-login-recall-ticket",
() => {
Expand Down
Loading