Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up logs #3242

Merged
merged 3 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion core/context/retrieval/repoMapRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ This is the question that you should select relevant files for: "${input}"`;
new AbortController().signal,
);
const content = renderChatMessage(response);
console.debug("Repo map retrieval response: ", content);

if (!content.includes("\n")) {
return [];
Expand Down
5 changes: 1 addition & 4 deletions core/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -860,10 +860,7 @@ export class Core {
this.indexingCancellationController &&
!this.indexingCancellationController.signal.aborted
) {
return console.debug(
"Codebase indexing already in progress, skipping indexing of files\n" +
files.join("\n"),
);
return;
}
this.indexingCancellationController = new AbortController();
for await (const update of (await this.codebaseIndexerPromise).refreshFiles(
Expand Down
5 changes: 1 addition & 4 deletions core/indexing/docs/DocsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
ContinueConfig,
EmbeddingsProvider,
IDE,
IdeInfo,
IndexingStatus,
SiteIndexingConfig,
IdeInfo,
} from "../..";
import { ConfigHandler } from "../../config/ConfigHandler";
import { addContextProvider } from "../../config/util";
Expand Down Expand Up @@ -69,7 +69,6 @@ export type AddParams = {
favicon?: string;
};


/*
General process:
- On config update:
Expand Down Expand Up @@ -476,8 +475,6 @@ export default class DocsService {
const embeddings: number[][] = [];

// Create embeddings of retrieved articles
console.debug(`Creating embeddings for ${articles.length} articles`);

for (let i = 0; i < articles.length; i++) {
const article = articles[i];

Expand Down
1 change: 1 addition & 0 deletions core/util/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const NEW_SESSION_TITLE = "New Session";
3 changes: 2 additions & 1 deletion core/util/history.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { v4 as uuidv4 } from "uuid";

import { Session } from "..";
import { NEW_SESSION_TITLE } from "./constants";
import historyManager from "./history";
import { getSessionFilePath } from "./paths";

Expand Down Expand Up @@ -31,7 +32,7 @@ describe("No sessions have been created", () => {
const session = historyManager.load(testSessionId);
expect(session).toEqual({
history: [],
title: "Failed to load session",
title: NEW_SESSION_TITLE,
workspaceDirectory: "",
sessionId: testSessionId,
});
Expand Down
4 changes: 2 additions & 2 deletions core/util/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import * as fs from "fs";
import { Session, SessionMetadata } from "../index.js";
import { ListHistoryOptions } from "../protocol/core.js";

import { NEW_SESSION_TITLE } from "./constants.js";
import { getSessionFilePath, getSessionsListPath } from "./paths.js";

function safeParseArray<T>(
value: string,
errorMessage: string = "Error parsing array",
Expand Down Expand Up @@ -80,7 +80,7 @@ class HistoryManager {
console.log(`Error loading session: ${e}`);
return {
history: [],
title: "Failed to load session",
title: NEW_SESSION_TITLE,
workspaceDirectory: "",
sessionId: sessionId,
};
Expand Down
8 changes: 7 additions & 1 deletion core/util/treeSitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,13 @@ export async function getSymbolsForFile(
return;
}

const tree = parser.parse(contents);
let tree: Parser.Tree;
try {
tree = parser.parse(contents);
} catch (e) {
console.log(`Error parsing file: ${filepath}`);
return;
}
// console.log(`file: ${filepath}`);

// Function to recursively find all named nodes (classes and functions)
Expand Down
4 changes: 2 additions & 2 deletions extensions/vscode/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions gui/src/components/FileIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,15 @@ export default function FileIcon({ filename, height, width }: FileIconProps) {
const sanitizedSVG = DOMPurify.sanitize(svg);

return (
<div
<span
dangerouslySetInnerHTML={{ __html: sanitizedSVG }}
style={{ width: width, height: height, fill: color, flexShrink: 0 }}
style={{
width: width,
height: height,
fill: color,
flexShrink: 0,
display: "block",
}}
/>
);
}
6 changes: 3 additions & 3 deletions gui/src/components/mainInput/ContextItemsPeek.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { getBasename } from "core/util";
import { useContext, useMemo, useState } from "react";
import { AnimatedEllipsis, lightGray, vscBackground } from "..";
import { IdeMessengerContext } from "../../context/IdeMessenger";
import { useAppSelector } from "../../redux/hooks";
import { selectIsGatheringContext } from "../../redux/slices/sessionSlice";
import FileIcon from "../FileIcon";
import SafeImg from "../SafeImg";
import { getIconFromDropdownItem } from "./MentionList";
import { useAppSelector } from "../../redux/hooks";
import { selectIsGatheringContext } from "../../redux/slices/sessionSlice";

interface ContextItemsPeekProps {
contextItems?: ContextItemWithId[];
Expand Down Expand Up @@ -172,7 +172,7 @@ function ContextItemsPeek({
<span className="ml-1 text-xs text-gray-400 transition-colors duration-200">
{isGatheringContext ? (
<>
Gathering context...
Gathering context
<AnimatedEllipsis />
</>
) : (
Expand Down
5 changes: 3 additions & 2 deletions gui/src/hooks/useHistory.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Dispatch } from "@reduxjs/toolkit";
import { Session, SessionMetadata } from "core";
import { NEW_SESSION_TITLE } from "core/util/constants";
import { renderChatMessage } from "core/util/messageContent";
import { useCallback, useContext } from "react";
import { IdeMessengerContext } from "../context/IdeMessenger";
Expand Down Expand Up @@ -65,7 +66,7 @@ function useHistory(dispatch: Dispatch) {
}

let currentTitle = title;
if (config?.ui?.getChatTitles && currentTitle === "New Session") {
if (config?.ui?.getChatTitles && currentTitle === NEW_SESSION_TITLE) {
try {
// Check if we have first assistant response
let assistantResponse = history
Expand All @@ -82,7 +83,7 @@ function useHistory(dispatch: Dispatch) {

// Fallback if we get an error above or if the user has not set getChatTitles
let newTitle =
currentTitle === "New Session"
currentTitle === NEW_SESSION_TITLE
? truncateText(
renderChatMessage(history[0].message)
.split("\n")
Expand Down
3 changes: 2 additions & 1 deletion gui/src/redux/slices/sessionSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
Session,
ToolCall,
} from "core";
import { NEW_SESSION_TITLE } from "core/util/constants";
import { incrementalParseJson } from "core/util/incrementalParseJson";
import { renderChatMessage } from "core/util/messageContent";
import { v4 as uuidv4 } from "uuid";
Expand Down Expand Up @@ -86,7 +87,7 @@ function getBaseHistoryItem(): ChatHistoryItemWithMessageId {
const initialState: SessionState = {
history: [],
isStreaming: false,
title: "New Session",
title: NEW_SESSION_TITLE,
id: uuidv4(),
selectedProfileId: "local",
curCheckpointIndex: 0,
Expand Down
Loading