Skip to content

Commit

Permalink
paths
Browse files Browse the repository at this point in the history
  • Loading branch information
RomneyDa committed Jan 27, 2025
1 parent 5960d5d commit 54a9f24
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 9 deletions.
28 changes: 27 additions & 1 deletion core/data/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const chatDevDataSchema = z.object({
});

export const autocompleteDevDataSchema = z.object({
// Tab autocomplete options - TODO - old json version?
disable: z.boolean(),
useFileSuffix: z.boolean(),
maxPromptTokens: z.number(),
Expand All @@ -49,10 +50,27 @@ export const autocompleteDevDataSchema = z.object({
useRecentlyEdited: z.boolean(),
disableInFiles: z.array(z.string()).optional(),
useImports: z.boolean().optional(),

// Other
accepted: z.boolean().optional(),
time: z.number(),
prefix: z.string(),
suffix: z.string(),
prompt: z.string(),
completion: z.string(),
modelProvider: z.string(),
modelName: z.string(),
completionOptions: z.unknown(), // Using z.unknown() for `any` type
cacheHit: z.boolean(),
filepath: z.string(),
gitRepo: z.string().optional(),
completionId: z.string(),
uniqueId: z.string(),
timestamp: z.number(),
});

export const devDataSchemas = z.object({
tokens_generated: tokensGeneratedDevDataSchema,
tokensGenerated: tokensGeneratedDevDataSchema,
chat: chatDevDataSchema,
quickEdit: quickEditDevDataSchema,
autocomplete: autocompleteDevDataSchema,
Expand All @@ -68,3 +86,11 @@ export type DevDataLogEvent = {
data: DevDataSchemas[K];
};
}[DevDataSchemaName];

// This is because of tokens_generated snake case file name
export const localDevDataFileNamesMap: Record<DevDataSchemaName, string> = {
tokensGenerated: "tokens_generated",
chat: "chat",
quickEdit: "quickEdit",
autocomplete: "autocomplete",
};
2 changes: 1 addition & 1 deletion core/llm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ export abstract class BaseLLM implements ILLM {
);

void DataLogger.getInstance().logDevData({
schema: "tokens_generated",
schema: "tokensGenerated",
data: {
model: model,
provider: this.providerName,
Expand Down
2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "file:///Users/dallin/Documents/code/continuedev/continue/packages/config-yaml/dist",
"@continuedev/config-yaml": "^1.0.16",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",
Expand Down
9 changes: 5 additions & 4 deletions core/util/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import dotenv from "dotenv";
import { IdeType, SerializedContinueConfig } from "../";
import { defaultConfig, defaultConfigJetBrains } from "../config/default";
import Types from "../config/types";
import { DevDataSchemaName, localDevDataFileNamesMap } from "../data/schemas";

dotenv.config();

Expand Down Expand Up @@ -210,8 +211,8 @@ export function getDevDataSqlitePath(): string {
return path.join(devDataPath(), "devdata.sqlite");
}

export function getDevDataFilePath(fileName: string): string {
return path.join(devDataPath(), `${fileName}.jsonl`);
export function getDevDataFilePath(schema: DevDataSchemaName): string {
return path.join(devDataPath(), `${localDevDataFileNamesMap[schema]}.jsonl`);
}

export function editConfigJson(
Expand Down Expand Up @@ -374,11 +375,11 @@ export function getEsbuildBinaryPath(): string {
}

export function setupInitialDotContinueDirectory() {
const devDataTypes = [
const devDataTypes: DevDataSchemaName[] = [
"chat",
"autocomplete",
"quickEdit",
"tokens_generated",
"tokensGenerated",
];
devDataTypes.forEach((p) => {
const devDataPath = getDevDataFilePath(p);
Expand Down
3 changes: 1 addition & 2 deletions extensions/vscode/src/quickEdit/QuickEditQuickPick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ export class QuickEdit {
}
let model = await this.getCurModelTitle();

const logger = DataLogger.getInstance();
void logger.logDevData({
void DataLogger.getInstance().logDevData({
schema: "quickEdit",
data: {
prompt,
Expand Down

0 comments on commit 54a9f24

Please sign in to comment.