Skip to content

Commit 906641d

Browse files
fix: chat with pat on local-only workspaces. (#136)
1 parent 0b21e9b commit 906641d

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

src/modules/github/chat/drawer.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,13 @@ export const createGitHubChatDrawer = ({
627627

628628
const collectRepositoryContext = () => {
629629
const repository = getSelectedRepository?.()
630+
const repositoryFullName =
631+
typeof repository?.fullName === 'string' ? repository.fullName.trim() : ''
632+
633+
if (!repositoryFullName) {
634+
return ''
635+
}
630636

631-
const repositoryLabel = toRepositoryLabel(repository)
632637
const repositoryUrl = toRepositoryUrl(repository)
633638
const defaultBranch =
634639
repository && typeof repository.defaultBranch === 'string'
@@ -637,7 +642,7 @@ export const createGitHubChatDrawer = ({
637642

638643
const contextLines = [
639644
'Selected repository context:',
640-
`- Repository: ${repositoryLabel}`,
645+
`- Repository: ${repositoryFullName}`,
641646
...(repositoryUrl ? [`- Repository URL: ${repositoryUrl}`] : []),
642647
`- Default branch: ${defaultBranch}`,
643648
'Use this repository as the default target for the user request unless they explicitly override it.',
@@ -743,12 +748,6 @@ export const createGitHubChatDrawer = ({
743748
return
744749
}
745750

746-
const repository = getSelectedRepository?.()
747-
if (!repository?.fullName) {
748-
setChatStatus('Select a writable repository before starting chat.', 'error')
749-
return
750-
}
751-
752751
const selectedModel = getSelectedModel()
753752

754753
stopPendingRequest()

src/modules/github/chat/payload.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,15 @@ export const buildOutboundMessages = ({
151151
styleMode,
152152
existingSummary,
153153
}) => {
154+
const normalizedRepositoryContext = toChatText(repositoryContext)
154155
const systemMessages = [
155156
{
156157
role: 'system',
157158
content: collectSystemRolePrompt({ renderMode, styleMode }),
158159
},
159-
{ role: 'system', content: repositoryContext },
160+
...(normalizedRepositoryContext
161+
? [{ role: 'system', content: normalizedRepositoryContext }]
162+
: []),
160163
...(editorContext ? [{ role: 'system', content: editorContext }] : []),
161164
]
162165
const conversation = collectConversation(messages)

0 commit comments

Comments
 (0)