✨ JetBrains up to date, many bug fixes
This commit is contained in:
parent
378dabfb88
commit
069997de3e
24 changed files with 144 additions and 114 deletions
5
.changes/extensions/intellij/v0.0.21.md
Normal file
5
.changes/extensions/intellij/v0.0.21.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
## v0.0.21 - 2023-12-05
|
||||
|
||||
### Added
|
||||
|
||||
- updated to match latest VS Code updates
|
||||
|
|
@ -6,6 +6,12 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
|
|||
and is generated by [Changie](https://github.com/miniscruff/changie).
|
||||
|
||||
|
||||
## v0.0.21 - 2023-12-05
|
||||
|
||||
### Added
|
||||
|
||||
- updated to match latest VS Code updates
|
||||
|
||||
## v0.0.19 - 2023-11-19
|
||||
|
||||
### Changed
|
||||
|
|
|
|||
|
|
@ -4,15 +4,16 @@ pluginGroup = com.github.continuedev.continueintellijextension
|
|||
pluginName = continue-intellij-extension
|
||||
pluginRepositoryUrl = https://github.com/continuedev/continue
|
||||
# SemVer format -> https://semver.org
|
||||
pluginVersion = 0.0.20
|
||||
pluginVersion = 0.0.21
|
||||
|
||||
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
|
||||
pluginSinceBuild = 223
|
||||
pluginUntilBuild = 232.*
|
||||
#pluginUntilBuild = 232.*
|
||||
|
||||
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
|
||||
platformType = IC
|
||||
platformVersion = 2022.3.3
|
||||
#platformVersion = LATEST-EAP-SNAPSHOT
|
||||
|
||||
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
|
||||
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
|
||||
|
|
|
|||
|
|
@ -226,4 +226,18 @@ class NewContinueSessionAction : AnAction() {
|
|||
continuePluginService.continuePluginWindow?.content?.components?.get(0)?.requestFocus()
|
||||
continuePluginService.dispatchCustomEvent("message", mutableMapOf("type" to "focusContinueInputWithNewSession"))
|
||||
}
|
||||
}
|
||||
|
||||
class ViewHistoryAction : AnAction() {
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val project = e.project
|
||||
if (project != null) {
|
||||
val toolWindowManager = ToolWindowManager.getInstance(project)
|
||||
val toolWindow = toolWindowManager.getToolWindow("Continue")
|
||||
}
|
||||
|
||||
val continuePluginService = pluginServiceFromActionEvent(e) ?: return
|
||||
|
||||
continuePluginService.dispatchCustomEvent("message", mutableMapOf("type" to "viewHistory"))
|
||||
}
|
||||
}
|
||||
|
|
@ -285,7 +285,7 @@ class IdeProtocolClient (
|
|||
version = ideVersion,
|
||||
remote_name = remoteName ?: ""
|
||||
),
|
||||
"server_url": getContinueServerUrl()
|
||||
"server_url" to getContinueServerUrl()
|
||||
)
|
||||
|
||||
val requestUrl = "${getContinueServerUrl()}/?window_info=${
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
package com.github.continuedev.continueintellijextension.toolWindow
|
||||
|
||||
import com.intellij.openapi.diagnostic.thisLogger
|
||||
import com.intellij.ui.components.JBPanel
|
||||
import com.intellij.ui.content.ContentFactory
|
||||
import com.intellij.ui.jcef.JBCefJSQuery
|
||||
import javax.swing.*
|
||||
import com.github.continuedev.continueintellijextension.activities.getContinueServerUrl
|
||||
import com.github.continuedev.continueintellijextension.`continue`.Position
|
||||
import com.github.continuedev.continueintellijextension.`continue`.Range
|
||||
|
|
@ -12,10 +7,13 @@ import com.github.continuedev.continueintellijextension.`continue`.RangeInFile
|
|||
import com.github.continuedev.continueintellijextension.`continue`.getMachineUniqueID
|
||||
import com.github.continuedev.continueintellijextension.factories.CustomSchemeHandlerFactory
|
||||
import com.github.continuedev.continueintellijextension.services.ContinuePluginService
|
||||
import com.github.continuedev.continueintellijextension.utils.runJsInWebview
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonObject
|
||||
import com.google.gson.JsonParser
|
||||
import com.intellij.openapi.actionSystem.ActionGroup
|
||||
import com.intellij.openapi.actionSystem.ActionManager
|
||||
import com.intellij.openapi.actionSystem.ActionToolbar
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.components.ServiceManager
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager
|
||||
import com.intellij.openapi.project.DumbAware
|
||||
|
|
@ -23,17 +21,19 @@ import com.intellij.openapi.project.Project
|
|||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.wm.ToolWindow
|
||||
import com.intellij.openapi.wm.ToolWindowFactory
|
||||
import com.intellij.ui.content.ContentFactory
|
||||
import com.intellij.ui.jcef.*
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import org.cef.CefApp
|
||||
import org.cef.browser.CefBrowser
|
||||
import org.cef.handler.CefLoadHandlerAdapter
|
||||
import javax.swing.JComponent
|
||||
import java.awt.BorderLayout
|
||||
import javax.swing.*
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
|
||||
|
||||
const val JS_QUERY_POOL_SIZE = "200"
|
||||
|
||||
class ContinuePluginToolWindowFactory : ToolWindowFactory, DumbAware {
|
||||
|
|
@ -41,6 +41,16 @@ class ContinuePluginToolWindowFactory : ToolWindowFactory, DumbAware {
|
|||
val continueToolWindow = ContinuePluginWindow(toolWindow, project)
|
||||
val content = ContentFactory.getInstance().createContent(continueToolWindow.content, null, false)
|
||||
toolWindow.contentManager.addContent(content)
|
||||
val titleActions = mutableListOf<AnAction>()
|
||||
createTitleActions(titleActions)
|
||||
toolWindow.setTitleActions(titleActions)
|
||||
}
|
||||
|
||||
private fun createTitleActions(titleActions: MutableList<in AnAction>) {
|
||||
val action = ActionManager.getInstance().getAction("ContinueSidebarActionsGroup")
|
||||
if (action != null) {
|
||||
titleActions.add(action)
|
||||
}
|
||||
}
|
||||
|
||||
override fun shouldBeAvailable(project: Project) = true
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<name>Continue</name>
|
||||
<vendor>continue-dev</vendor>
|
||||
<depends>com.intellij.modules.platform</depends>
|
||||
<idea-version since-build="223.0" until-build="233.*"/>
|
||||
<idea-version since-build="223.0"/>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<toolWindow id="Continue" anchor="right" icon="/tool-window-icon.png"
|
||||
|
|
@ -80,6 +80,7 @@
|
|||
<action id="continue.newContinueSession"
|
||||
class="com.github.continuedev.continueintellijextension.actions.NewContinueSessionAction"
|
||||
text="Start New Continue Session"
|
||||
icon="AllIcons.General.Add"
|
||||
description="Start New Continue Session">
|
||||
<keyboard-shortcut keymap="$default"
|
||||
first-keystroke="alt ctrl N"/>
|
||||
|
|
@ -87,6 +88,12 @@
|
|||
first-keystroke="alt meta N"/>
|
||||
</action>
|
||||
|
||||
<action id="continue.viewHistory"
|
||||
class="com.github.continuedev.continueintellijextension.actions.ViewHistoryAction"
|
||||
text="View History"
|
||||
icon="AllIcons.Vcs.History"
|
||||
description="View History">
|
||||
</action>
|
||||
<action id="continue.focusContinueInput"
|
||||
class="com.github.continuedev.continueintellijextension.actions.FocusContinueInputAction"
|
||||
text="Add selected code to context"
|
||||
|
|
@ -98,6 +105,11 @@
|
|||
<add-to-group group-id="EditorPopupMenu"/>
|
||||
</action>
|
||||
|
||||
<group id="ContinueSidebarActionsGroup">
|
||||
<reference ref="continue.newContinueSession"/>
|
||||
<reference ref="continue.viewHistory"/>
|
||||
</group>
|
||||
|
||||
</actions>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -640,7 +640,8 @@
|
|||
"CommentCodeStep",
|
||||
"ClearHistoryStep",
|
||||
"StackOverflowStep",
|
||||
"OpenConfigStep"
|
||||
"OpenConfigStep",
|
||||
"DraftIssueStep"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -14,24 +14,26 @@ export function getSidebarContent(
|
|||
edits: FileEdit[] | undefined = undefined,
|
||||
isFullScreen: boolean = false
|
||||
): string {
|
||||
debugPanelWebview = panel.webview;
|
||||
panel.onDidDispose(() => {
|
||||
debugPanelWebview = undefined;
|
||||
});
|
||||
if (!isFullScreen) {
|
||||
debugPanelWebview = panel.webview;
|
||||
panel.onDidDispose(() => {
|
||||
debugPanelWebview = undefined;
|
||||
});
|
||||
}
|
||||
|
||||
let extensionUri = getExtensionUri();
|
||||
let scriptUri: string;
|
||||
let styleMainUri: string;
|
||||
let vscMediaUrl: string = debugPanelWebview
|
||||
let vscMediaUrl: string = panel.webview
|
||||
.asWebviewUri(vscode.Uri.joinPath(extensionUri, "gui"))
|
||||
.toString();
|
||||
|
||||
const isProduction = true; // context?.extensionMode === vscode.ExtensionMode.Development;
|
||||
if (isProduction) {
|
||||
scriptUri = debugPanelWebview
|
||||
scriptUri = panel.webview
|
||||
.asWebviewUri(vscode.Uri.joinPath(extensionUri, "gui/assets/index.js"))
|
||||
.toString();
|
||||
styleMainUri = debugPanelWebview
|
||||
styleMainUri = panel.webview
|
||||
.asWebviewUri(vscode.Uri.joinPath(extensionUri, "gui/assets/index.css"))
|
||||
.toString();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ const Layout = () => {
|
|||
return () => {
|
||||
window.removeEventListener("message", handler);
|
||||
};
|
||||
}, []);
|
||||
}, [location, navigate]);
|
||||
|
||||
return (
|
||||
<LayoutTopDiv>
|
||||
|
|
|
|||
|
|
@ -1080,6 +1080,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
|
|||
setShowContextItemsIfNotMain(true);
|
||||
}
|
||||
}}
|
||||
id="snippets-selected-div"
|
||||
style={{
|
||||
color: lightGray,
|
||||
backgroundColor: vscBackground,
|
||||
|
|
@ -1206,6 +1207,9 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
|
|||
topRef.current?.contains(e.relatedTarget as Node) ||
|
||||
document
|
||||
.getElementById("toggle-context-div")
|
||||
?.contains(e.relatedTarget as Node) ||
|
||||
document
|
||||
.getElementById("snippets-selected-div")
|
||||
?.contains(e.relatedTarget as Node)
|
||||
) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -591,74 +591,6 @@ function GUI(props: GUIProps) {
|
|||
}
|
||||
}}
|
||||
>
|
||||
{localStorage.getItem("ide") === "jetbrains" && (
|
||||
<GUIHeaderDiv>
|
||||
<TitleTextInput
|
||||
onClick={(e) => {
|
||||
// Select all text
|
||||
(e.target as any).setSelectionRange(
|
||||
0,
|
||||
(e.target as any).value.length
|
||||
);
|
||||
}}
|
||||
value={sessionTitleInput}
|
||||
onChange={(e) => setSessionTitleInput(e.target.value)}
|
||||
onBlur={(e) => {
|
||||
if (
|
||||
e.target.value === sessionTitle ||
|
||||
(typeof sessionTitle === "undefined" &&
|
||||
e.target.value === "New Session")
|
||||
)
|
||||
return;
|
||||
dispatch(setTitle(e.target.value));
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") {
|
||||
e.preventDefault();
|
||||
(e.target as any).blur();
|
||||
} else if (e.key === "Escape") {
|
||||
setSessionTitleInput(sessionTitle || "New Session");
|
||||
(e.target as any).blur();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<div className="flex gap-2">
|
||||
{localStorage.getItem("ide") === "vscode" && (
|
||||
<HeaderButtonWithText
|
||||
onClick={() => {
|
||||
postToIde("toggleFullScreen", {});
|
||||
}}
|
||||
text={`Toggle Full Screen (${getMetaKeyLabel()}K ${getMetaKeyLabel()}M)`}
|
||||
>
|
||||
{(window as any).isFullScreen ? (
|
||||
<ArrowsPointingInIcon width="1.4em" height="1.4em" />
|
||||
) : (
|
||||
<ArrowsPointingOutIcon width="1.4em" height="1.4em" />
|
||||
)}
|
||||
</HeaderButtonWithText>
|
||||
)}
|
||||
<HeaderButtonWithText
|
||||
onClick={() => {
|
||||
client?.stopSession();
|
||||
client?.persistSession(sessionState, workspacePaths[0] || "");
|
||||
dispatch(newSession());
|
||||
}}
|
||||
text={`New Session (⌥${getMetaKeyLabel()}N)`}
|
||||
>
|
||||
<PlusIcon width="1.4em" height="1.4em" />
|
||||
</HeaderButtonWithText>
|
||||
|
||||
<HeaderButtonWithText
|
||||
onClick={() => {
|
||||
navigate("/history");
|
||||
}}
|
||||
text="History"
|
||||
>
|
||||
<FolderIcon width="1.4em" height="1.4em" />
|
||||
</HeaderButtonWithText>
|
||||
</div>
|
||||
</GUIHeaderDiv>
|
||||
)}
|
||||
{takenAction && showLoading && typeof client === "undefined" && (
|
||||
<>
|
||||
<RingLoader size={32} />
|
||||
|
|
|
|||
|
|
@ -248,8 +248,8 @@ class Autopilot:
|
|||
index=index,
|
||||
update=SetStep(
|
||||
error=ContinueError(
|
||||
title=continue_custom_exception.title,
|
||||
message=continue_custom_exception.message,
|
||||
title=continue_custom_exception.title or "Error",
|
||||
message=continue_custom_exception.message or "Error",
|
||||
),
|
||||
hide=False,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -163,6 +163,20 @@ class StepDescription(BaseModel):
|
|||
for key, value in update.dict(exclude_none=True).items():
|
||||
setattr(self, key, value)
|
||||
|
||||
@staticmethod
|
||||
def from_empty() -> "StepDescription":
|
||||
return StepDescription(
|
||||
step_type="EmptyStep",
|
||||
name="",
|
||||
description="",
|
||||
params={},
|
||||
hide=True,
|
||||
depth=0,
|
||||
error=None,
|
||||
observations=[],
|
||||
logs=[],
|
||||
)
|
||||
|
||||
|
||||
class SessionUpdate(BaseModel):
|
||||
index: int
|
||||
|
|
@ -296,6 +310,21 @@ class SessionState(ContinueBaseModel):
|
|||
def from_empty():
|
||||
return SessionState(history=[], context_items=[])
|
||||
|
||||
@classmethod
|
||||
def parse_obj(cls, obj: Any):
|
||||
# Safety net against the client sending malformed data
|
||||
valid_steps = []
|
||||
for step in obj["history"]:
|
||||
try:
|
||||
StepDescription.parse_obj(step)
|
||||
valid_steps.append(step)
|
||||
except Exception:
|
||||
valid_steps.append(StepDescription.from_empty())
|
||||
|
||||
obj["history"] = valid_steps
|
||||
|
||||
return super().parse_obj(obj)
|
||||
|
||||
|
||||
class ContinueSDK:
|
||||
async def run_step(self, step: "Step"):
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ class GGML(LLM):
|
|||
"""
|
||||
|
||||
api_base: Optional[str] = Field(
|
||||
"http://localhost:8000",
|
||||
"http://127.0.0.1:8000",
|
||||
description="URL of the OpenAI-compatible server where the model is being served",
|
||||
)
|
||||
|
||||
@validator("api_base", pre=True, always=True)
|
||||
def set_api_base(cls, api_base):
|
||||
return api_base or "http://localhost:8000"
|
||||
return api_base or "http://127.0.0.1:8000"
|
||||
|
||||
model: str = Field(
|
||||
"ggml", description="The name of the model to use (optional for the GGML class)"
|
||||
|
|
@ -56,9 +56,10 @@ class GGML(LLM):
|
|||
)
|
||||
|
||||
chat_endpoint: str = Field(
|
||||
default="chat/completions", description="The endpoint to call for chat completions"
|
||||
default="chat/completions",
|
||||
description="The endpoint to call for chat completions",
|
||||
)
|
||||
|
||||
|
||||
completions_endpoint: str = Field(
|
||||
default="completions", description="The endpoint to call for chat completions"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ from .base import LLM, CompletionOptions
|
|||
class HuggingFaceTGI(LLM):
|
||||
model: str = "huggingface-tgi"
|
||||
api_base: Optional[str] = Field(
|
||||
"http://localhost:8080", description="URL of your TGI server"
|
||||
"http://127.0.0.1:8080", description="URL of your TGI server"
|
||||
)
|
||||
|
||||
@validator("api_base", pre=True, always=True)
|
||||
def set_api_base(cls, api_base):
|
||||
return api_base or "http://localhost:8080"
|
||||
return api_base or "http://127.0.0.1:8080"
|
||||
|
||||
class Config:
|
||||
arbitrary_types_allowed = True
|
||||
|
|
|
|||
|
|
@ -30,12 +30,12 @@ class LlamaCpp(LLM):
|
|||
|
||||
model: str = "llamacpp"
|
||||
api_base: Optional[str] = Field(
|
||||
"http://localhost:8080", description="URL of the server"
|
||||
"http://127.0.0.1:8080", description="URL of the server"
|
||||
)
|
||||
|
||||
@validator("api_base", pre=True, always=True)
|
||||
def set_api_base(cls, api_base):
|
||||
return api_base or "http://localhost:8080"
|
||||
return api_base or "http://127.0.0.1:8080"
|
||||
|
||||
llama_cpp_args: Dict[str, Any] = Field(
|
||||
{"stop": ["[INST]"]},
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@ from .ggml import GGML
|
|||
class LMStudio(GGML):
|
||||
"""LMStudio provides a professional and well-designed GUI for exploring, configuring, and serving LLMs. It is available on both Mac and Windows. To get started:\n1. Download from [lmstudio.ai](https://lmstudio.ai/) and open the application\n2. Search for and download the desired model from the home screen of LMStudio.\n3. In the left-bar, click the '<->' icon to open the Local Inference Server and press 'Start Server'.\n4. Once your model is loaded and the server has started, you can begin using Continue."""
|
||||
|
||||
api_base: str = "http://localhost:1234"
|
||||
api_base: str = "http://127.0.0.1:1234"
|
||||
|
|
|
|||
|
|
@ -26,12 +26,12 @@ class Ollama(LLM):
|
|||
|
||||
model: str = "llama2"
|
||||
api_base: Optional[str] = Field(
|
||||
"http://localhost:11434", description="URL of the Ollama server"
|
||||
"http://127.0.0.1:11434", description="URL of the Ollama server"
|
||||
)
|
||||
|
||||
@validator("api_base", pre=True, always=True)
|
||||
def set_api_base(cls, api_base):
|
||||
return api_base or "http://localhost:11434"
|
||||
return api_base or "http://127.0.0.1:11434"
|
||||
|
||||
class Config:
|
||||
arbitrary_types_allowed = True
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ class TextGenWebUI(LLM):
|
|||
|
||||
model: str = "text-gen-webui"
|
||||
api_base: Optional[str] = Field(
|
||||
"http://localhost:5000", description="URL of your TextGenWebUI server"
|
||||
"http://127.0.0.1:5000", description="URL of your TextGenWebUI server"
|
||||
)
|
||||
streaming_url: Optional[str] = Field(
|
||||
"http://localhost:5005",
|
||||
"http://127.0.0.1:5005",
|
||||
description="URL of your TextGenWebUI streaming server (separate from main server URL)",
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ def prune_chat_history(
|
|||
|
||||
|
||||
# In case we've missed weird edge cases
|
||||
TOKEN_BUFFER_FOR_SAFETY = 100
|
||||
TOKEN_BUFFER_FOR_SAFETY = 350
|
||||
|
||||
|
||||
def flatten_messages(msgs: List[ChatMessage]) -> List[ChatMessage]:
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ def kill_proc(port):
|
|||
try:
|
||||
for conns in proc.connections(kind="inet"):
|
||||
if conns.laddr.port == port:
|
||||
proc.send_signal(signal.SIGKILL)
|
||||
proc.send_signal(signal.SIGTERM)
|
||||
except psutil.AccessDenied:
|
||||
logger.warning(f"Failed to kill process on port {port} (access denied)")
|
||||
return
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class GUIProtocolServer(AbstractGUIProtocolServer):
|
|||
window_id: str
|
||||
messenger: SocketIOMessenger
|
||||
|
||||
get_autopilot: Callable[[SessionState], Optional[Autopilot]]
|
||||
get_autopilot: Callable[[SessionState, "GUIProtocolServer"], Optional[Autopilot]]
|
||||
get_context_item: Callable[[str, str], Awaitable[Optional[ContextItem]]]
|
||||
get_config: Callable[[], Optional[ContinueConfig]]
|
||||
reload_config: AsyncFunc
|
||||
|
|
@ -38,7 +38,9 @@ class GUIProtocolServer(AbstractGUIProtocolServer):
|
|||
window_id: str,
|
||||
sio: socketio.AsyncServer,
|
||||
sid: str,
|
||||
get_autopilot: Callable[[SessionState], Optional[Autopilot]],
|
||||
get_autopilot: Callable[
|
||||
[SessionState, "GUIProtocolServer"], Optional[Autopilot]
|
||||
],
|
||||
get_context_item: Callable[[str, str], Awaitable[Optional[ContextItem]]],
|
||||
get_config: Callable[[], Optional[ContinueConfig]],
|
||||
reload_config: Callable,
|
||||
|
|
@ -63,9 +65,15 @@ class GUIProtocolServer(AbstractGUIProtocolServer):
|
|||
return ctx_item.dict()
|
||||
return None
|
||||
elif msg.message_type == "get_session_title":
|
||||
return await self.get_session_title(
|
||||
[StepDescription(**step) for step in data["history"]]
|
||||
)
|
||||
# guard against malformed data from the client
|
||||
valid_steps = []
|
||||
for step in data["history"]:
|
||||
try:
|
||||
valid_steps.append(StepDescription(**step))
|
||||
except Exception:
|
||||
valid_steps.append(StepDescription.from_empty())
|
||||
|
||||
return await self.get_session_title(valid_steps)
|
||||
elif msg.message_type == "get_config":
|
||||
if config := self.get_config():
|
||||
return config.dict()
|
||||
|
|
@ -116,7 +124,7 @@ class GUIProtocolServer(AbstractGUIProtocolServer):
|
|||
_running_autopilots: Dict[str, Autopilot] = {}
|
||||
|
||||
async def run_from_state(self, state: SessionState, step: Optional[Step] = None):
|
||||
if autopilot := self.get_autopilot(state):
|
||||
if autopilot := self.get_autopilot(state, self):
|
||||
if step is not None or len(state.history) > 0:
|
||||
step_to_log = step or state.history[-1]
|
||||
posthog_logger.capture_event(
|
||||
|
|
@ -170,7 +178,7 @@ class GUIProtocolServer(AbstractGUIProtocolServer):
|
|||
|
||||
async def get_session_title(self, history: List[StepDescription]) -> str:
|
||||
if autopilot := self.get_autopilot(
|
||||
SessionState(history=history, context_items=[])
|
||||
SessionState(history=history, context_items=[]), self
|
||||
):
|
||||
return await autopilot.get_session_title()
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -52,7 +52,12 @@ class Window:
|
|||
def __init__(self, config: Optional[ContinueConfig] = None) -> None:
|
||||
self.reload_config()
|
||||
|
||||
def get_autopilot(self, session_state: SessionState) -> Optional[Autopilot]:
|
||||
def get_autopilot(
|
||||
self, session_state: SessionState, gui: GUIProtocolServer
|
||||
) -> Optional[Autopilot]:
|
||||
if self.gui is None:
|
||||
self.gui = gui
|
||||
|
||||
if self.ide is None or self.gui is None or self.config is None:
|
||||
return None
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue