From c929865f6cf16b51f3faa6d32a132f203fb87947 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 15:10:08 -0800 Subject: [PATCH 01/18] pr_checks require all --- .github/workflows/pr_checks.yaml | 48 +++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index f629f9331..5edabf18c 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -97,7 +97,7 @@ 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 @@ -158,7 +158,7 @@ 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 @@ -194,7 +194,7 @@ 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 @@ -283,7 +283,7 @@ 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: @@ -312,7 +312,7 @@ jobs: vscode-package-extension: runs-on: ubuntu-latest - needs: [ install-vscode, install-core ] + needs: [install-vscode, install-core] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -344,7 +344,7 @@ jobs: vscode-download-e2e-dependencies: runs-on: ubuntu-latest - needs: [ install-vscode, install-core ] + needs: [install-vscode, install-core] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -390,7 +390,7 @@ jobs: 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 - uses: actions/setup-node@v4 @@ -451,7 +451,7 @@ 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 @@ -482,7 +482,7 @@ jobs: npm test jetbrains-tests: - needs: [ install-root, core-checks ] + needs: [install-root, core-checks] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -578,4 +578,32 @@ jobs: with: name: jb-failure-report path: | - ${{ github.workspace }}/extensions/intellij/build/reports \ No newline at end of file + ${{ github.workspace }}/extensions/intellij/build/reports + + check: + 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) }} From 2260300d6478383aed22ad0e5399964dc2d8ac12 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 15:12:34 -0800 Subject: [PATCH 02/18] use production environment for core-checks --- .github/workflows/pr_checks.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 5edabf18c..c01e2fe67 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -70,6 +70,7 @@ jobs: core-checks: needs: install-core runs-on: ubuntu-latest + environment: production steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 From 97309a61faeb9475e3948665073036a7d01389d0 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 15:14:59 -0800 Subject: [PATCH 03/18] fix syntax --- .github/workflows/pr_checks.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index c01e2fe67..351b4707e 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -605,6 +605,6 @@ jobs: - name: Decide whether the needed jobs succeeded or failed uses: re-actors/alls-green@release/v1 with: - allowed-failures: [] - allowed-skips: [] + allowed-failures: + allowed-skips: jobs: ${{ toJSON(needs) }} From caca9a9612f50f362eee38263380a712a000e3e5 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 15:22:30 -0800 Subject: [PATCH 04/18] only require approval on forks --- .github/workflows/pr_checks.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 351b4707e..b9db610a8 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -70,8 +70,12 @@ jobs: core-checks: needs: install-core runs-on: ubuntu-latest - environment: production + environment: ${{ github.event.pull_request.head.repo.fork && 'production' || '' }} steps: + - name: Print whether fork + run: | + echo "Fork: ${github.event.pull_request.head.repo.fork}" + - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: From 4955a6fa1a58745bcd83d281489111f2faf775f6 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 15:24:09 -0800 Subject: [PATCH 05/18] fix syntax --- .github/workflows/pr_checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index b9db610a8..483b782c0 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -74,7 +74,7 @@ jobs: steps: - name: Print whether fork run: | - echo "Fork: ${github.event.pull_request.head.repo.fork}" + echo "Fork: ${{ github.event.pull_request.head.repo.fork }}" - uses: actions/checkout@v4 - uses: actions/setup-node@v4 From c236b6c87c93dd720acaaad87d3f5cc5022587ae Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 15:39:31 -0800 Subject: [PATCH 06/18] rename --- .github/workflows/pr_checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 483b782c0..e93302d09 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -585,7 +585,7 @@ jobs: path: | ${{ github.workspace }}/extensions/intellij/build/reports - check: + require-all-checks-to-pass: if: always() runs-on: ubuntu-latest needs: From b729174dff8cb8d172e23b0256abffa0fb54c106 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 15:57:00 -0800 Subject: [PATCH 07/18] change env --- .github/workflows/pr_checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index e93302d09..e94065589 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -70,7 +70,7 @@ jobs: core-checks: needs: install-core runs-on: ubuntu-latest - environment: ${{ github.event.pull_request.head.repo.fork && 'production' || '' }} + environment: ${{ github.event.pull_request.head.repo.fork && 'tests-requiring-secrets' || '' }} steps: - name: Print whether fork run: | From 105bb380349e603467449c3f0d8b7016d5bed767 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 16:05:58 -0800 Subject: [PATCH 08/18] add comments and require environment at the top of the file --- .github/workflows/pr_checks.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index e94065589..1e080a2d7 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -21,6 +21,9 @@ on: - "gui/**" - ".github/workflows/**" +# Tests requiring secrets need approval from maintainers +environment: ${{ github.event.pull_request.head.repo.fork && 'tests-requiring-secrets' || '' }} + jobs: install-root: runs-on: ubuntu-latest @@ -70,7 +73,6 @@ jobs: core-checks: needs: install-core runs-on: ubuntu-latest - environment: ${{ github.event.pull_request.head.repo.fork && 'tests-requiring-secrets' || '' }} steps: - name: Print whether fork run: | @@ -399,8 +401,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" + with: node-version-k - uses: actions/cache@v4 id: vscode-node-modules-cache @@ -585,6 +586,9 @@ jobs: path: | ${{ 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 From 06b3cb35a0b7d51152f0b75a051c5ada5aaba135 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 17:03:28 -0800 Subject: [PATCH 09/18] fix syntax error --- .github/workflows/pr_checks.yaml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 1e080a2d7..9b5a858f8 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -21,9 +21,6 @@ on: - "gui/**" - ".github/workflows/**" -# Tests requiring secrets need approval from maintainers -environment: ${{ github.event.pull_request.head.repo.fork && 'tests-requiring-secrets' || '' }} - jobs: install-root: runs-on: ubuntu-latest @@ -73,11 +70,9 @@ jobs: core-checks: needs: install-core runs-on: ubuntu-latest + # Tests requiring secrets need approval from maintainers + environment: ${{ github.event.pull_request.head.repo.fork && 'tests-requiring-secrets' || '' }} steps: - - name: Print whether fork - run: | - echo "Fork: ${{ github.event.pull_request.head.repo.fork }}" - - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: @@ -393,6 +388,8 @@ jobs: install-core, ] runs-on: ubuntu-latest + # Tests requiring secrets need approval from maintainers + environment: ${{ github.event.pull_request.head.repo.fork && 'tests-requiring-secrets' || '' }} strategy: fail-fast: false matrix: From 23c595cf3d649a088f4e8832253ae0bdddadedf3 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 17:06:49 -0800 Subject: [PATCH 10/18] fix syntax again --- .github/workflows/pr_checks.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 9b5a858f8..81fb93701 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -398,7 +398,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 - with: node-version-k + with: + node-version-file: ".nvmrc" - uses: actions/cache@v4 id: vscode-node-modules-cache From dae89dea1bf7a0a644a7476fd6dd14976da489b3 Mon Sep 17 00:00:00 2001 From: German Swan Date: Fri, 24 Jan 2025 22:31:26 +0200 Subject: [PATCH 11/18] 3832: DeepSeek-R1 reasoning display can be toggled --- core/index.d.ts | 6 ++ extensions/vscode/package-lock.json | 4 +- .../components/StepContainer/Reasoning.tsx | 64 +++++++++++++++++++ .../StepContainer/StepContainer.tsx | 15 +++-- .../markdown/StyledMarkdownPreview.tsx | 10 ++- gui/src/redux/slices/sessionSlice.ts | 21 +++++- 6 files changed, 108 insertions(+), 12 deletions(-) create mode 100644 gui/src/components/StepContainer/Reasoning.tsx diff --git a/core/index.d.ts b/core/index.d.ts index 03c32a8b5..3a94202a2 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -425,6 +425,11 @@ interface ToolCallState { output?: ContextItem[]; } +interface Reasoning { + active: boolean; + text: string; +} + export interface ChatHistoryItem { message: ChatMessage; contextItems: ContextItemWithId[]; @@ -435,6 +440,7 @@ export interface ChatHistoryItem { isGatheringContext?: boolean; checkpoint?: Checkpoint; isBeforeCheckpoint?: boolean; + reasoning?: Reasoning; } export interface LLMFullCompletionOptions extends BaseCompletionOptions { diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 38d0db7c8..c9d9e1741 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.254", + "version": "0.9.255", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.254", + "version": "0.9.255", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3", diff --git a/gui/src/components/StepContainer/Reasoning.tsx b/gui/src/components/StepContainer/Reasoning.tsx new file mode 100644 index 000000000..23da63cc5 --- /dev/null +++ b/gui/src/components/StepContainer/Reasoning.tsx @@ -0,0 +1,64 @@ +import { ChatHistoryItem } from "core"; +import { stripImages } from "core/util/messageContent"; +import { 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` + 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 ContentDiv = styled.div<{ fontSize?: number }>` + margin: 4px; + padding: 4px; + font-size: ${getFontSize()}px; + overflow: hidden; + border-left: 4px solid ${lightGray}; + border-radius: ${defaultBorderRadius}; + background-color: ${vscQuickInputBackground}; +`; + +export default function Reasoning(props: ReasoningProps) { + const [open, setOpen] = useState(false); + + if (!props.item.reasoning?.text) { + return null; + } + + return <> + setOpen(!open)}> {open ? "Hide reasoning" : "Show reasoning"} + {open && ( + + )} + +} diff --git a/gui/src/components/StepContainer/StepContainer.tsx b/gui/src/components/StepContainer/StepContainer.tsx index 5709f7f60..b395db076 100644 --- a/gui/src/components/StepContainer/StepContainer.tsx +++ b/gui/src/components/StepContainer/StepContainer.tsx @@ -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)} ) : ( - + <> + + + + )} {props.isLast && } diff --git a/gui/src/components/markdown/StyledMarkdownPreview.tsx b/gui/src/components/markdown/StyledMarkdownPreview.tsx index 52d343fe4..931c8c045 100644 --- a/gui/src/components/markdown/StyledMarkdownPreview.tsx +++ b/gui/src/components/markdown/StyledMarkdownPreview.tsx @@ -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 ( - + {reactContent} ); diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index 33ba33f59..1aa66b438 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -362,9 +362,24 @@ 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("")) { + lastItem.reasoning = { + active: true, + text: messageContent.replace("", "").trim(), + } + } else if (lastItem.reasoning?.active && messageContent.includes("")) { + const [reasoningEnd, answerStart] = messageContent.split(""); + lastItem.reasoning.text += reasoningEnd.trimEnd(); + lastItem.reasoning.active = false; + 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] && From d67a0a025974bb1561335a0d5f3e999e7a1af964 Mon Sep 17 00:00:00 2001 From: German Swan Date: Fri, 24 Jan 2025 23:08:03 +0200 Subject: [PATCH 12/18] 3832: added elapsed time --- core/index.d.ts | 2 ++ .../components/StepContainer/Reasoning.tsx | 19 +++++++++++++++++-- gui/src/redux/slices/sessionSlice.ts | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/core/index.d.ts b/core/index.d.ts index 3a94202a2..9dc670da5 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -428,6 +428,8 @@ interface ToolCallState { interface Reasoning { active: boolean; text: string; + startAt: number; + endAt?: number; } export interface ChatHistoryItem { diff --git a/gui/src/components/StepContainer/Reasoning.tsx b/gui/src/components/StepContainer/Reasoning.tsx index 23da63cc5..c817111f4 100644 --- a/gui/src/components/StepContainer/Reasoning.tsx +++ b/gui/src/components/StepContainer/Reasoning.tsx @@ -1,6 +1,6 @@ import { ChatHistoryItem } from "core"; import { stripImages } from "core/util/messageContent"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import styled from "styled-components"; import { defaultBorderRadius, lightGray, vscBackground, vscQuickInputBackground, } from ".."; import { getFontSize } from "../../util"; @@ -45,13 +45,28 @@ const ContentDiv = styled.div<{ fontSize?: number }>` export default function Reasoning(props: ReasoningProps) { const [open, setOpen] = useState(false); + const [reasoningTime, setReasoningTime] = useState(""); + + useEffect(() => { + if (!props.item.reasoning) return; + + const interval = setInterval(() => { + 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) + }, 100); + + return () => clearInterval(interval); + }, [props.item.reasoning?.startAt, props.item.reasoning?.endAt]) if (!props.item.reasoning?.text) { return null; } return <> - setOpen(!open)}> {open ? "Hide reasoning" : "Show reasoning"} + setOpen(!open)}> {open ? "Hide" : "Show"} reasoning: {reasoningTime} {open && ( ")) { lastItem.reasoning = { + startAt: Date.now(), active: true, text: messageContent.replace("", "").trim(), } @@ -372,6 +373,7 @@ export const sessionSlice = createSlice({ const [reasoningEnd, answerStart] = messageContent.split(""); 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; From f9eeeabc98e2e5ca28b9da8a6fa70274a57d5c4a Mon Sep 17 00:00:00 2001 From: German Swan Date: Wed, 29 Jan 2025 00:07:29 +0200 Subject: [PATCH 13/18] 3832: ui improvements --- .../components/StepContainer/Reasoning.tsx | 104 ++++++++++++++---- 1 file changed, 81 insertions(+), 23 deletions(-) diff --git a/gui/src/components/StepContainer/Reasoning.tsx b/gui/src/components/StepContainer/Reasoning.tsx index c817111f4..9b57dbb99 100644 --- a/gui/src/components/StepContainer/Reasoning.tsx +++ b/gui/src/components/StepContainer/Reasoning.tsx @@ -2,9 +2,15 @@ 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 { + defaultBorderRadius, + lightGray, + vscBackground, + vscQuickInputBackground, +} from ".."; import { getFontSize } from "../../util"; import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview"; +import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/solid"; interface ReasoningProps { item: ChatHistoryItem; @@ -13,6 +19,7 @@ interface ReasoningProps { } const SpoilerButton = styled.div` + margin: 8px 6px 16px 6px; background-color: ${vscBackground}; width: fit-content; font-size: ${getFontSize() - 2}px; @@ -33,6 +40,12 @@ const SpoilerButton = styled.div` } `; +const ButtonContent = styled.div` + display: flex; + align-items: center; + gap: 6px; +`; + const ContentDiv = styled.div<{ fontSize?: number }>` margin: 4px; padding: 4px; @@ -43,37 +56,82 @@ const ContentDiv = styled.div<{ fontSize?: number }>` 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 interval = setInterval(() => { - 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) - }, 100); - - return () => clearInterval(interval); - }, [props.item.reasoning?.startAt, props.item.reasoning?.endAt]) + 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 <> - setOpen(!open)}> {open ? "Hide" : "Show"} reasoning: {reasoningTime} - {open && ( - - )} - -} + return ( + <> + setOpen(!open)}> + + {isThinking ? ( + Thinking + ) : ( + `Thought for ${reasoningTime}` + )} + {open ? ( + + ) : ( + + )} + + + {open && ( + + + + )} + + ); +} \ No newline at end of file From 0915ea993e5d29aa43b56fa03dc04ba1b2d230af Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 30 Jan 2025 09:02:21 -0800 Subject: [PATCH 14/18] require permission --- .github/workflows/pr_checks.yaml | 69 +++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 81fb93701..f5a8ed0ac 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -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: ${{ github.event.pull_request.head.repo.fork && '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,10 +86,13 @@ jobs: core-checks: needs: install-core runs-on: ubuntu-latest - # Tests requiring secrets need approval from maintainers environment: ${{ github.event.pull_request.head.repo.fork && '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" @@ -103,6 +122,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" @@ -134,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" @@ -164,6 +191,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" @@ -200,6 +231,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" @@ -233,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" @@ -264,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" @@ -290,6 +333,9 @@ jobs: 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 @@ -317,6 +363,10 @@ jobs: 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" @@ -349,6 +399,10 @@ jobs: 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" @@ -397,6 +451,10 @@ jobs: 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" @@ -459,6 +517,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" @@ -490,6 +552,9 @@ 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/cache@v4 with: From 3e5f0738db4e80bb24f2757414ff2f36223b6476 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 30 Jan 2025 09:10:11 -0800 Subject: [PATCH 15/18] adjust padding --- gui/src/components/StepContainer/Reasoning.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gui/src/components/StepContainer/Reasoning.tsx b/gui/src/components/StepContainer/Reasoning.tsx index 9b57dbb99..27ad10120 100644 --- a/gui/src/components/StepContainer/Reasoning.tsx +++ b/gui/src/components/StepContainer/Reasoning.tsx @@ -1,3 +1,4 @@ +import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/solid"; import { ChatHistoryItem } from "core"; import { stripImages } from "core/util/messageContent"; import { useEffect, useState } from "react"; @@ -10,7 +11,6 @@ import { } from ".."; import { getFontSize } from "../../util"; import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview"; -import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/solid"; interface ReasoningProps { item: ChatHistoryItem; @@ -49,6 +49,7 @@ const ButtonContent = styled.div` const ContentDiv = styled.div<{ fontSize?: number }>` margin: 4px; padding: 4px; + padding-bottom: 6px; font-size: ${getFontSize()}px; overflow: hidden; border-left: 4px solid ${lightGray}; @@ -134,4 +135,4 @@ export default function Reasoning(props: ReasoningProps) { )} ); -} \ No newline at end of file +} From f15e0fa6257f19c95eea3e1f5b5b858989ec8807 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 30 Jan 2025 09:31:04 -0800 Subject: [PATCH 16/18] env --- .github/workflows/pr_checks.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index f5a8ed0ac..ccc9e8a44 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -24,7 +24,7 @@ on: jobs: validate-pr: runs-on: ubuntu-latest - environment: ${{ github.event.pull_request.head.repo.fork && 'tests-requiring-secrets' || '' }} + environment: tests-requiring-secrets steps: - uses: actions/checkout@v4 @@ -86,7 +86,7 @@ jobs: core-checks: needs: install-core runs-on: ubuntu-latest - environment: ${{ github.event.pull_request.head.repo.fork && 'tests-requiring-secrets' || '' }} + environment: tests-requiring-secrets steps: - uses: actions/checkout@v4 with: @@ -443,7 +443,7 @@ jobs: ] runs-on: ubuntu-latest # Tests requiring secrets need approval from maintainers - environment: ${{ github.event.pull_request.head.repo.fork && 'tests-requiring-secrets' || '' }} + environment: tests-requiring-secrets strategy: fail-fast: false matrix: From a2b4c3a8b888059a56d38b44959f0814340b29e2 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 30 Jan 2025 09:32:11 -0800 Subject: [PATCH 17/18] update padding --- gui/src/components/StepContainer/Reasoning.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/components/StepContainer/Reasoning.tsx b/gui/src/components/StepContainer/Reasoning.tsx index 27ad10120..d5537c82b 100644 --- a/gui/src/components/StepContainer/Reasoning.tsx +++ b/gui/src/components/StepContainer/Reasoning.tsx @@ -49,7 +49,7 @@ const ButtonContent = styled.div` const ContentDiv = styled.div<{ fontSize?: number }>` margin: 4px; padding: 4px; - padding-bottom: 6px; + padding-bottom: 8px; font-size: ${getFontSize()}px; overflow: hidden; border-left: 4px solid ${lightGray}; From 28f377afae3670c56f744efda0cce0b5ce0f4ece Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 30 Jan 2025 09:34:30 -0800 Subject: [PATCH 18/18] bump version --- extensions/vscode/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index fd5f55a70..9664499f4 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "0.9.255", + "version": "0.9.258", "repository": { "type": "git", "url": "https://github.com/continuedev/continue"