Merge branch 'main' into dallin/config-ui

This commit is contained in:
Dallin Romney 2025-01-30 10:25:45 -08:00 • committed by GitHub
commit 803bf833d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 298 additions and 24 deletions

View file

@ -1,7 +1,7 @@
name: PR checks
on:
pull_request:
pull_request_target:
branches:
- main
paths:
@ -22,10 +22,22 @@ on:
- ".github/workflows/**"
jobs:
validate-pr:
runs-on: ubuntu-latest
environment: tests-requiring-secrets
steps:
- uses: actions/checkout@v4
install-root:
needs: validate-pr
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
# This is important - it switches from the base repo to the fork
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -45,6 +57,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -70,8 +86,13 @@ jobs:
core-checks:
needs: install-core
runs-on: ubuntu-latest
environment: tests-requiring-secrets
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -97,10 +118,14 @@ jobs:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
install-gui:
needs: [ install-root, install-core ]
needs: [install-root, install-core]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -132,6 +157,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -158,10 +187,14 @@ jobs:
npx tsc --noEmit
binary-checks:
needs: [ install-root, install-core ]
needs: [install-root, install-core]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -194,10 +227,14 @@ jobs:
npx tsc --noEmit
install-vscode:
needs: [ install-root, install-core ]
needs: [install-root, install-core]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -231,6 +268,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -262,6 +303,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -283,11 +328,14 @@ jobs:
vscode-get-test-file-matrix:
runs-on: ubuntu-latest
needs: [ install-root, install-vscode ]
needs: [install-root, install-vscode]
outputs:
test_file_matrix: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Cache node modules
uses: actions/cache@v3
@ -312,9 +360,13 @@ jobs:
vscode-package-extension:
runs-on: ubuntu-latest
needs: [ install-vscode, install-core ]
needs: [install-vscode, install-core]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -344,9 +396,13 @@ jobs:
vscode-download-e2e-dependencies:
runs-on: ubuntu-latest
needs: [ install-vscode, install-core ]
needs: [install-vscode, install-core]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -386,13 +442,19 @@ jobs:
install-core,
]
runs-on: ubuntu-latest
# Tests requiring secrets need approval from maintainers
environment: tests-requiring-secrets
strategy:
fail-fast: false
matrix:
test_file: ${{ fromJson(needs.vscode-get-test-file-matrix.outputs.test_file_matrix) }}
command: [ "e2e:ci:run", "e2e:ci:run-yaml" ]
command: ["e2e:ci:run", "e2e:ci:run-yaml"]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -451,10 +513,14 @@ jobs:
path: extensions/vscode/e2e/storage/screenshots
gui-tests:
needs: [ install-gui, install-core ]
needs: [install-gui, install-core]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -482,10 +548,13 @@ jobs:
npm test
jetbrains-tests:
needs: [ install-root, core-checks ]
needs: [install-root, core-checks]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/cache@v4
with:
@ -578,4 +647,35 @@ jobs:
with:
name: jb-failure-report
path: |
${{ github.workspace }}/extensions/intellij/build/reports
${{ github.workspace }}/extensions/intellij/build/reports
# GitHub does not have a way of requiring that all checks pass (you must manually select each job)
# This action at least lets us manage the list of required tests via source control
# so that creators of new jobs can add them to this list
require-all-checks-to-pass:
if: always()
runs-on: ubuntu-latest
needs:
- install-root
- install-core
- core-checks
- install-gui
- gui-checks
- binary-checks
- install-vscode
- vscode-checks
- core-tests
- vscode-get-test-file-matrix
- vscode-package-extension
- vscode-download-e2e-dependencies
- vscode-e2e-tests
- gui-tests
- jetbrains-tests
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
allowed-failures:
allowed-skips:
jobs: ${{ toJSON(needs) }}

8
core/index.d.ts vendored
View file

@ -433,6 +433,13 @@ interface ToolCallState {
output?: ContextItem[];
}
interface Reasoning {
active: boolean;
text: string;
startAt: number;
endAt?: number;
}
export interface ChatHistoryItem {
message: ChatMessage;
contextItems: ContextItemWithId[];
@ -443,6 +450,7 @@ export interface ChatHistoryItem {
isGatheringContext?: boolean;
checkpoint?: Checkpoint;
isBeforeCheckpoint?: boolean;
reasoning?: Reasoning;
}
export interface LLMFullCompletionOptions extends BaseCompletionOptions {

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "0.9.257",
"version": "0.9.255",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "0.9.257",
"version": "0.9.255",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/fetch": "^1.0.3",

View file

@ -2,7 +2,7 @@
"name": "continue",
"icon": "media/icon.png",
"author": "Continue Dev, Inc",
"version": "0.9.257",
"version": "0.9.258",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"

View file

@ -0,0 +1,138 @@
import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/solid";
import { ChatHistoryItem } from "core";
import { stripImages } from "core/util/messageContent";
import { useEffect, useState } from "react";
import styled from "styled-components";
import {
defaultBorderRadius,
lightGray,
vscBackground,
vscQuickInputBackground,
} from "..";
import { getFontSize } from "../../util";
import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview";
interface ReasoningProps {
item: ChatHistoryItem;
index: number;
isLast: boolean;
}
const SpoilerButton = styled.div`
margin: 8px 6px 16px 6px;
background-color: ${vscBackground};
width: fit-content;
font-size: ${getFontSize() - 2}px;
border: 0.5px solid ${lightGray};
border-radius: ${defaultBorderRadius};
padding: 4px 8px;
color: ${lightGray};
cursor: pointer;
box-shadow:
0 4px 6px rgba(0, 0, 0, 0.1),
0 1px 3px rgba(0, 0, 0, 0.08);
transition: box-shadow 0.3s ease;
&:hover {
box-shadow:
0 6px 8px rgba(0, 0, 0, 0.15),
0 3px 6px rgba(0, 0, 0, 0.1);
}
`;
const ButtonContent = styled.div`
display: flex;
align-items: center;
gap: 6px;
`;
const ContentDiv = styled.div<{ fontSize?: number }>`
margin: 4px;
padding: 4px;
padding-bottom: 8px;
font-size: ${getFontSize()}px;
overflow: hidden;
border-left: 4px solid ${lightGray};
border-radius: ${defaultBorderRadius};
background-color: ${vscQuickInputBackground};
`;
const ThinkingText = styled.span`
position: relative;
padding-right: 12px;
&:after {
content: "...";
position: absolute;
animation: ellipsis 1s steps(4, end) infinite;
width: 0px;
display: inline-block;
overflow: hidden;
}
@keyframes ellipsis {
0%,
100% {
width: 0px;
}
33% {
width: 8px;
}
66% {
width: 16px;
}
90% {
width: 24px;
}
}
`;
export default function Reasoning(props: ReasoningProps) {
const [open, setOpen] = useState(false);
const [reasoningTime, setReasoningTime] = useState("");
const isThinking = !props.item.reasoning?.endAt;
useEffect(() => {
if (!props.item.reasoning) return;
if (!props.item.reasoning?.endAt) return;
const startAt = props.item.reasoning?.startAt || Date.now();
const endAt = props.item.reasoning?.endAt || Date.now();
const diff = endAt - startAt;
const diffString = `${(diff / 1000).toFixed(1)}s`;
setReasoningTime(diffString);
}, [props.item.reasoning?.startAt, props.item.reasoning?.endAt]);
if (!props.item.reasoning?.text) {
return null;
}
return (
<>
<SpoilerButton onClick={() => setOpen(!open)}>
<ButtonContent>
{isThinking ? (
<ThinkingText>Thinking</ThinkingText>
) : (
`Thought for ${reasoningTime}`
)}
{open ? (
<ChevronUpIcon className="h-3 w-3" />
) : (
<ChevronDownIcon className="h-3 w-3" />
)}
</ButtonContent>
</SpoilerButton>
{open && (
<ContentDiv>
<StyledMarkdownPreview
isRenderingInStepContainer
source={stripImages(props.item.reasoning.text)}
itemIndex={props.index}
useParentBackgroundColor
/>
</ContentDiv>
)}
</>
);
}

View file

@ -11,6 +11,7 @@ import { getFontSize } from "../../util";
import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview";
import ResponseActions from "./ResponseActions";
import ThinkingIndicator from "./ThinkingIndicator";
import Reasoning from "./Reasoning";
interface StepContainerProps {
item: ChatHistoryItem;
@ -90,11 +91,15 @@ export default function StepContainer(props: StepContainerProps) {
{renderChatMessage(props.item.message)}
</pre>
) : (
<StyledMarkdownPreview
isRenderingInStepContainer
source={stripImages(props.item.message.content)}
itemIndex={props.index}
/>
<>
<Reasoning {...props}/>
<StyledMarkdownPreview
isRenderingInStepContainer
source={stripImages(props.item.message.content)}
itemIndex={props.index}
/>
</>
)}
{props.isLast && <ThinkingIndicator historyItem={props.item} />}
</ContentDiv>

View file

@ -34,6 +34,7 @@ import { remarkTables } from "./utils/remarkTables";
const StyledMarkdown = styled.div<{
fontSize?: number;
whiteSpace: string;
bgColor: string;
}>`
pre {
white-space: ${(props) => props.whiteSpace};
@ -63,7 +64,7 @@ const StyledMarkdown = styled.div<{
color: #f78383;
}
background-color: ${vscBackground};
background-color: ${(props) => props.bgColor};
font-family:
var(--vscode-font-family),
system-ui,
@ -104,6 +105,7 @@ interface StyledMarkdownPreviewProps {
isRenderingInStepContainer?: boolean; // Currently only used to control the rendering of codeblocks
scrollLocked?: boolean;
itemIndex?: number;
useParentBackgroundColor?: boolean;
}
const HLJS_LANGUAGE_CLASSNAME_PREFIX = "language-";
@ -332,7 +334,11 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview(
const uiConfig = useAppSelector(selectUIConfig);
const codeWrapState = uiConfig?.codeWrap ? "pre-wrap" : "pre";
return (
<StyledMarkdown fontSize={getFontSize()} whiteSpace={codeWrapState}>
<StyledMarkdown
fontSize={getFontSize()}
whiteSpace={codeWrapState}
bgColor={props.useParentBackgroundColor ? "" : vscBackground}
>
{reactContent}
</StyledMarkdown>
);

View file

@ -362,9 +362,26 @@ export const sessionSlice = createSlice({
} else {
// Add to the existing message
if (message.content) {
// Note this only works because new message above
// was already rendered from parts to string
lastMessage.content += renderChatMessage(message);
const messageContent = renderChatMessage(message);
if (messageContent.includes("<think>")) {
lastItem.reasoning = {
startAt: Date.now(),
active: true,
text: messageContent.replace("<think>", "").trim(),
}
} else if (lastItem.reasoning?.active && messageContent.includes("</think>")) {
const [reasoningEnd, answerStart] = messageContent.split("</think>");
lastItem.reasoning.text += reasoningEnd.trimEnd();
lastItem.reasoning.active = false;
lastItem.reasoning.endAt = Date.now();
lastMessage.content += answerStart.trimStart();
} else if (lastItem.reasoning?.active) {
lastItem.reasoning.text += messageContent;
} else {
// Note this only works because new message above
// was already rendered from parts to string
lastMessage.content += messageContent;
}
} else if (
message.role === "assistant" &&
message.toolCalls?.[0] &&