-
Notifications
You must be signed in to change notification settings - Fork 413
/
types.ts
47 lines (41 loc) · 1.01 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
interface File {
name: string;
path: string;
isDirectory: boolean;
content?: string;
snippets?: Snippet[];
}
interface Snippet {
file: string;
start: number;
end: number;
entireFile: string;
content: string;
}
interface FileChangeRequest {
snippet: Snippet;
instructions: string;
newContents: string;
changeType: "create" | "modify";
hideMerge: boolean;
isLoading: boolean;
readOnlySnippets: { [key: string]: Snippet };
diff: string;
status: "queued" | "in-progress" | "done" | "error" | "idle";
}
const fcrEqual = (a: FileChangeRequest, b: FileChangeRequest) => {
return (
a.snippet.file === b.snippet.file &&
a.snippet.start === b.snippet.start &&
a.snippet.end === b.snippet.end
);
};
const snippetKey = (snippet: Snippet) => {
return `${snippet.file}:${snippet.start || 0}-${snippet.end || 0}`;
};
interface Message {
role: "user" | "system" | "assistant";
content: string;
}
export { fcrEqual, snippetKey };
export type { File, Snippet, FileChangeRequest, Message };