Merge pull request #7116 from continuedev/pe/devdata-fixed
fix: standardize dev data schemas and add missing fields
This commit is contained in:
commit
187d445557
27 changed files with 52 additions and 9 deletions
|
|
@ -387,6 +387,7 @@ declare global {
|
|||
|
||||
export interface PromptLog {
|
||||
modelTitle: string;
|
||||
modelProvider: string;
|
||||
completionOptions: CompletionOptions;
|
||||
prompt: string;
|
||||
completion: string;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ const TEST_AGENT_INTERACTION_EVENT: DevDataLogEvent = {
|
|||
prompt: "Hello, world!",
|
||||
completion: "Hello, world!",
|
||||
modelProvider: "openai",
|
||||
modelName: "gpt-4",
|
||||
modelTitle: "gpt-4",
|
||||
sessionId: "1234",
|
||||
tools: ["test-tool1"],
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ const INFINITE_STREAM_SAFETY = 0.9;
|
|||
|
||||
const DUD_PROMPT_LOG: PromptLog = {
|
||||
modelTitle: "",
|
||||
modelProvider: "",
|
||||
completionOptions: { model: "" },
|
||||
prompt: "",
|
||||
completion: "",
|
||||
|
|
|
|||
1
core/index.d.ts
vendored
1
core/index.d.ts
vendored
|
|
@ -455,6 +455,7 @@ export type FileSymbolMap = Record<string, SymbolWithRange[]>;
|
|||
|
||||
export interface PromptLog {
|
||||
modelTitle: string;
|
||||
modelProvider: string;
|
||||
completionOptions: CompletionOptions;
|
||||
prompt: string;
|
||||
completion: string;
|
||||
|
|
|
|||
|
|
@ -779,6 +779,7 @@ export abstract class BaseLLM implements ILLM {
|
|||
|
||||
return {
|
||||
modelTitle: this.title ?? completionOptions.model,
|
||||
modelProvider: this.underlyingProviderName,
|
||||
prompt,
|
||||
completion,
|
||||
completionOptions,
|
||||
|
|
@ -1094,6 +1095,7 @@ export abstract class BaseLLM implements ILLM {
|
|||
|
||||
return {
|
||||
modelTitle: this.title ?? completionOptions.model,
|
||||
modelProvider: this.underlyingProviderName,
|
||||
prompt,
|
||||
completion,
|
||||
completionOptions,
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ async function dudLLMCall(llm: ILLM, messages: ChatMessage[]) {
|
|||
model: "",
|
||||
},
|
||||
modelTitle: "",
|
||||
modelProvider: "",
|
||||
prompt: "",
|
||||
});
|
||||
abortController.abort();
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ export async function* llmStreamChat(
|
|||
// Log to return in case of error
|
||||
const errorPromptLog = {
|
||||
modelTitle: model?.title ?? model?.model,
|
||||
modelProvider: model?.underlyingProviderName ?? "unknown",
|
||||
completion: "",
|
||||
prompt: "",
|
||||
completionOptions: {
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ export const processNextEditData = async ({
|
|||
// undefined;
|
||||
|
||||
const modelName = "Codestral";
|
||||
const modelProvider = "mistral";
|
||||
const maxPromptTokens = randomNumberBetween(500, 12000);
|
||||
|
||||
const autocompleteContext = await getAutocompleteContext(
|
||||
|
|
@ -124,6 +125,9 @@ export const processNextEditData = async ({
|
|||
beforeCursorPos: cursorPosBeforeEdit,
|
||||
afterCursorPos: cursorPosAfterPrevEdit,
|
||||
context: autocompleteContext,
|
||||
modelProvider,
|
||||
modelName,
|
||||
modelTitle: modelName,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -536,6 +536,7 @@ export class VerticalDiffManager {
|
|||
streamId: EDIT_MODE_STREAM_ID,
|
||||
timestamp: new Date().toISOString(),
|
||||
modelProvider: model.underlyingProviderName,
|
||||
modelName: model.title ?? "",
|
||||
modelTitle: model.title ?? "",
|
||||
prompt: stripImages(prompt),
|
||||
completion: newCode,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ export interface PendingEditData {
|
|||
streamId: string;
|
||||
timestamp: string;
|
||||
modelProvider: string;
|
||||
modelName: string;
|
||||
modelTitle: string;
|
||||
prompt: string;
|
||||
completion: string;
|
||||
|
|
@ -56,7 +57,8 @@ class EditOutcomeTracker {
|
|||
name: "editOutcome",
|
||||
data: {
|
||||
modelProvider: pendingEdit.modelProvider,
|
||||
modelTitle: pendingEdit.modelTitle,
|
||||
modelName: pendingEdit.modelName,
|
||||
modelTitle: pendingEdit.modelName,
|
||||
prompt: pendingEdit.prompt,
|
||||
completion: pendingEdit.completion,
|
||||
previousCode: pendingEdit.previousCode,
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import { showTutorial } from "../util/tutorial";
|
|||
import { getExtensionUri } from "../util/vscode";
|
||||
import { VsCodeIde } from "../VsCodeIde";
|
||||
import { VsCodeWebviewProtocol } from "../webviewProtocol";
|
||||
|
||||
import { VsCodeExtension } from "./VsCodeExtension";
|
||||
|
||||
type ToIdeOrWebviewFromCoreProtocol = ToIdeFromCoreProtocol &
|
||||
|
|
@ -240,6 +241,7 @@ export class VsCodeMessenger {
|
|||
prompt: stripImages(prompt),
|
||||
completion: fileAfterEdit ?? "",
|
||||
modelProvider: model.underlyingProviderName,
|
||||
modelName: model.title ?? "",
|
||||
modelTitle: model.title ?? "",
|
||||
filepath: msg.data.range.filepath,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -238,15 +238,15 @@ export class QuickEdit {
|
|||
prompt: string,
|
||||
path: string | undefined,
|
||||
) => {
|
||||
const model = await this.getCurModel();
|
||||
if (!model) {
|
||||
const modelTitle = await this.getCurModel();
|
||||
if (!modelTitle) {
|
||||
throw new Error("No model selected");
|
||||
}
|
||||
|
||||
const { config } = await this.configHandler.loadConfig();
|
||||
const rules = config?.rules ?? []; // no need to error - getCurModel above will handle
|
||||
|
||||
await this._streamEditWithInputAndContext(prompt, model, rules);
|
||||
await this._streamEditWithInputAndContext(prompt, modelTitle, rules);
|
||||
this.openAcceptRejectMenu(prompt, path);
|
||||
};
|
||||
|
||||
|
|
@ -352,9 +352,9 @@ export class QuickEdit {
|
|||
label: QuickEditInitialItemLabels | undefined;
|
||||
value: string | undefined;
|
||||
}> {
|
||||
const modelTitle = await this.getCurModel();
|
||||
const model = await this.getCurModel();
|
||||
|
||||
if (!modelTitle) {
|
||||
if (!model) {
|
||||
this.ide.showToast("error", "Please configure a model to use Quick Edit");
|
||||
return { label: undefined, value: undefined };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,10 +21,14 @@ export function FeedbackButtons({ item }: FeedbackButtonsProps) {
|
|||
setFeedback(feedback);
|
||||
if (item.promptLogs?.length) {
|
||||
for (const promptLog of item.promptLogs) {
|
||||
const { modelTitle, modelProvider, ...logData } = promptLog;
|
||||
ideMessenger.post("devdata/log", {
|
||||
name: "chatFeedback",
|
||||
data: {
|
||||
...promptLog,
|
||||
...logData,
|
||||
modelProvider: modelProvider || "unknown",
|
||||
modelName: modelTitle,
|
||||
modelTitle: modelTitle,
|
||||
feedback,
|
||||
sessionId,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -273,6 +273,7 @@ export const streamNormalInput = createAsyncThunk<
|
|||
prompt: next.value.prompt,
|
||||
completion: next.value.completion,
|
||||
modelProvider: selectedChatModel.underlyingProviderName,
|
||||
modelName: selectedChatModel.title,
|
||||
modelTitle: selectedChatModel.title,
|
||||
sessionId: state.session.id,
|
||||
...(!!activeTools.length && {
|
||||
|
|
|
|||
|
|
@ -461,6 +461,7 @@ describe("streamResponseThunk", () => {
|
|||
prompt: "Hello",
|
||||
completion: "Hi there!",
|
||||
modelProvider: "anthropic",
|
||||
modelName: "Claude 3.5 Sonnet",
|
||||
modelTitle: "Claude 3.5 Sonnet",
|
||||
sessionId: "session-123",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { store } from "../redux/store";
|
|||
*/
|
||||
function extractModelInfo(toolCallState: ToolCallState): {
|
||||
modelProvider: string;
|
||||
modelName: string;
|
||||
modelTitle: string;
|
||||
} {
|
||||
// Get the conversation history to find the model info
|
||||
|
|
@ -28,6 +29,7 @@ function extractModelInfo(toolCallState: ToolCallState): {
|
|||
const modelParts = String(assistantMessage.message.model).split("::");
|
||||
return {
|
||||
modelProvider: modelParts[0] || "unknown",
|
||||
modelName: modelParts[1] || String(assistantMessage.message.model),
|
||||
modelTitle: modelParts[1] || String(assistantMessage.message.model),
|
||||
};
|
||||
}
|
||||
|
|
@ -38,6 +40,7 @@ function extractModelInfo(toolCallState: ToolCallState): {
|
|||
|
||||
return {
|
||||
modelProvider: chatModel?.provider || "unknown",
|
||||
modelName: chatModel?.model || "unknown",
|
||||
modelTitle: chatModel?.model || "unknown",
|
||||
};
|
||||
}
|
||||
|
|
@ -153,7 +156,8 @@ export function assembleEditOutcomeData(
|
|||
streamId: applyState.streamId,
|
||||
timestamp: new Date().toISOString(),
|
||||
modelProvider: modelInfo.modelProvider,
|
||||
modelTitle: modelInfo.modelTitle,
|
||||
modelName: modelInfo.modelName,
|
||||
modelTitle: modelInfo.modelName,
|
||||
prompt: promptAndCompletion.prompt,
|
||||
completion: promptAndCompletion.completion,
|
||||
previousCode: codeChanges.previousCode,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ import { z } from "zod";
|
|||
import { baseDevDataAllSchema } from "../base.js";
|
||||
|
||||
export const chatFeedbackEventAllSchema = baseDevDataAllSchema.extend({
|
||||
modelProvider: z.string(),
|
||||
modelName: z.string(),
|
||||
modelTitle: z.string(),
|
||||
completionOptions: z.object({}),
|
||||
prompt: z.string(),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { chatFeedbackEventAllSchema } from "./index.js";
|
||||
|
||||
export const chatFeedbackEventSchema_0_1_0 = chatFeedbackEventAllSchema.pick({
|
||||
modelTitle: true,
|
||||
modelName: true,
|
||||
completionOptions: true,
|
||||
prompt: true,
|
||||
completion: true,
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ export const chatFeedbackEventSchema_0_2_0 = chatFeedbackEventAllSchema.pick({
|
|||
// other
|
||||
prompt: true,
|
||||
completion: true,
|
||||
modelProvider: true,
|
||||
modelName: true,
|
||||
modelTitle: true,
|
||||
feedback: true,
|
||||
sessionId: true,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { baseDevDataAllSchema } from "../base.js";
|
|||
|
||||
export const chatInteractionEventAllSchema = baseDevDataAllSchema.extend({
|
||||
modelProvider: z.string(),
|
||||
modelName: z.string(),
|
||||
modelTitle: z.string(),
|
||||
prompt: z.string(),
|
||||
completion: z.string(),
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ export const chatInteractionEventSchema_0_2_0 =
|
|||
// other
|
||||
prompt: true,
|
||||
completion: true,
|
||||
modelName: true,
|
||||
modelTitle: true,
|
||||
modelProvider: true,
|
||||
sessionId: true,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import { baseDevDataAllSchema } from "../base.js";
|
|||
*/
|
||||
export const editInteractionEventAllSchema = baseDevDataAllSchema.extend({
|
||||
modelProvider: z.string(),
|
||||
modelName: z.string(),
|
||||
modelTitle: z.string(),
|
||||
prompt: z.string(),
|
||||
completion: z.string(),
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ export const editInteractionEventSchema_0_2_0 =
|
|||
// other
|
||||
prompt: true,
|
||||
completion: true,
|
||||
modelName: true,
|
||||
modelTitle: true,
|
||||
modelProvider: true,
|
||||
filepath: true,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { baseDevDataAllSchema } from "../base.js";
|
|||
|
||||
export const editOutcomeEventAllSchema = baseDevDataAllSchema.extend({
|
||||
modelProvider: z.string(),
|
||||
modelName: z.string(),
|
||||
modelTitle: z.string(),
|
||||
prompt: z.string(),
|
||||
completion: z.string(),
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ export const editOutcomeEventSchema_0_2_0 = editOutcomeEventAllSchema.pick({
|
|||
// other
|
||||
prompt: true,
|
||||
completion: true,
|
||||
modelName: true,
|
||||
modelTitle: true,
|
||||
modelProvider: true,
|
||||
accepted: true,
|
||||
|
|
|
|||
|
|
@ -15,4 +15,7 @@ export const nextEditEventAllSchema = baseDevDataAllSchema.extend({
|
|||
beforeCursorPos: z.object({ line: z.number(), character: z.number() }),
|
||||
afterCursorPos: z.object({ line: z.number(), character: z.number() }),
|
||||
context: z.string(),
|
||||
modelProvider: z.string(),
|
||||
modelName: z.string(),
|
||||
modelTitle: z.string(),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ export const nextEditEventSchema_0_2_0 = nextEditEventAllSchema.pick({
|
|||
beforeCursorPos: true,
|
||||
afterCursorPos: true,
|
||||
context: true,
|
||||
modelProvider: true,
|
||||
modelName: true,
|
||||
modelTitle: true,
|
||||
});
|
||||
|
||||
export const nextEditEventSchema_0_2_0_noCode = nextEditEventSchema_0_2_0.omit({
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue