Skip to content

Commit

Permalink
Fix the bug that the first one returned by stream is \n, which is una…
Browse files Browse the repository at this point in the history
…cceptable, and re-plan the partition for the sidebar.
  • Loading branch information
Wzixiao committed Nov 1, 2023
1 parent 9b3d4bf commit a17f2ed
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ export class BigcodeInlineCompletionProvider
);

const items: IInlineCompletionItem[] = [];
if (this._lastRequestInfo.insertText.startsWith(newAddedCodeText)) {
if (
this._lastRequestInfo.insertText.startsWith(newAddedCodeText) &&
newAddedCodeText !== ''
) {
items.push({
isIncomplete: false,
insertText: this._lastRequestInfo.insertText.replace(
Expand Down
28 changes: 18 additions & 10 deletions packages/jupyter-ai/src/components/bigcode-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,31 @@ export const BigCodeSetting = observer(() => {
onChange={toggleCodeCompletionWrapper}
/>
</h1>
{CodeCompletionContextstore.enableCodeCompletion && (

<div
className={
CodeCompletionContextstore.enableCodeCompletion
? 'code-completion-setting-entered'
: 'code-completion-setting-exiting'
}
>
<h1 className="jp-ai-ChatSettings-header bigcode-setting-level-1-title">
Enable mock test code completion
<Switch
checked={CodeCompletionContextstore.enableMockTest}
onChange={toggleMockTestWrapper}
/>
</h1>
)}

<h2 className="jp-ai-ChatSettings-header">Short cut for completion</h2>
<TextField
label="Please press the short cut you need"
value={CodeCompletionContextstore.shortcutStr}
fullWidth
type="text"
onKeyDown={setHotKeyWrapper}
/>
</div>

<div
className={
Expand All @@ -113,14 +129,6 @@ export const BigCodeSetting = observer(() => {
type="password"
onChange={e => setAccessTokenWrapper(e.target.value)}
/>
<h2 className="jp-ai-ChatSettings-header">Short cut for completion</h2>
<TextField
label="Please press the short cut you need"
value={CodeCompletionContextstore.shortcutStr}
fullWidth
type="text"
onKeyDown={setHotKeyWrapper}
/>
<h1 className="jp-ai-ChatSettings-header bigcode-setting-level-1-title">
Advanced Settings
</h1>
Expand Down

0 comments on commit a17f2ed

Please sign in to comment.