continue icon indicating copy to clipboard operation
continue copied to clipboard

(Deepseek-Coder) Seemingly character limited in VSCode

Open SirenGlitch opened this issue 1 year ago • 3 comments

Before submitting your bug report

Relevant environment info

- OS: Windows 10 19045.4046
- Continue: v0.9.84
- IDE: VSCode 1.87.1
- Model Deepseek-coder:6.7b, provider=ollama (may or may not be relevant)

Description

Code writing gets cut off when writing for semi-long periods of time, leading to unfinished code

To reproduce

  1. Create new Python file
  2. Open Quick Edit ( ^I )
  3. Enter prompt: "make a python script for a simple snake game using pygame"
  4. Wait for a few seconds
  5. View end of file

A result I got:

import pygame
import time
import random

# Initialize Pygame
pygame.init()

# Set up some constants for our game
WIDTH, HEIGHT = 640, 480
CELL_SIZE = 20
CELLS_X, CELLS_Y = WIDTH // CELL_SIZE, HEIGHT // CELL_SIZE

# Colors
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)

# Initial snake position and direction
snake_pos = [(CELLS_X // 2, CELLS_Y // 2)]
direction = (1, 0) # Right

# Food generation
food_pos = (random.randint(0, CELLS_X - 1), random.randint(0, CELLS_Y - 1))
food_spawned = time.time()
FOOD_SPAWN_TIME = 2 # in seconds

# Main game window
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption('Snake Game')

def draw_grid():
  for x in range(0, WIDTH, CELL_SIZE):
        pygame.draw.line(screen, BLACK, (x, 0), (x, HEIGHT))
    for y in range(0, HEIGHT, CELL_SIZE):
        pygame.draw.line(screen, BLACK, (0, y), (WIDTH, y))

def draw_snake():
    for x, y in snake_pos:
        pygame.draw.rect(screen, WHITE, pygame.Rect(x * CELL_SIZE, y * CELL_SIZE, CELL_SIZE, CELL_SIZE))

def draw_food():
    pygame.draw.rect(screen, RED, pygame.Rect(food_pos[0] * CELL_SIZE, food_pos[1] * CELL_SIZE, CELL_SIZE, CELL_SIZE))

def move_snake():
    global direction
    
    # Create new head position
    x = (snake_pos[0][0] + direction[0]) % CELLS_X
    y = (snake_pos[0][1] + direction[1]) % CELLS_Y
    snake_pos.insert(0, (x, y))
    
    # Check for food collision and grow if necessary
    if snake_pos[0] == food_pos:
        food_spawned = time.time()
    else:
        snake_pos.pop()

def check_events():
    global running, direction
    
    # Event loop
    for event in pygame.event.get():
        
        # Quit game if window closed
        if event.type == pygame.QUIT:
            running = False
            
        elif event.type == pygame.KEYDOWN:
            
            # Change direction based on key presses
            if event.key == pygame.K_UP and direction != (0, 1):
                direction = (0, -1)
            elif event.key == pygame.K_RIGHT and direction != (-1, 0):
                direction = (1, 0)
            elif event.key == pygame.K_DOWN and direction != (0, -1):
                direction = (0, 1)
            elif event.key == pygame.K_LEFT and direction != (1, 0):
                direction = (-1, 0)
    
def spawn_food():
    global food_pos, food_spawned
    
    # Check if enough time has passed to respawn a new piece of food
    if time.time() - food_spawned >= FOOD_SPAWN_TIME:
        food_pos = (random.randint(0, CELLS_X - 1), random.randint(0, CELLS_Y - 1))
        food_spawned = time.time()
    
def game():
    global running
    
    # Game loop
    while running:
        
        check_events()
        move_snake()
        spawn_food()
        
        screen.fill(BL

Log output

[Extension Host] No newFilepath provided to reject the diff, diffs.size was 0 console.ts:137 
[Extension Host] No newFilepath provided to accept the diff console.ts:137

SirenGlitch avatar Mar 12 '24 17:03 SirenGlitch

Just in case it's relevant, passing the same prompt directly to the Model works fine, only through Continue does the problem occur

SirenGlitch avatar Mar 12 '24 17:03 SirenGlitch

Also happens in sidebar menu, not just Quick Edit

SirenGlitch avatar Mar 12 '24 19:03 SirenGlitch

@SirenGlitch We typically set the maxTokens property to half of the context length because it plus the prompt length cannot exceed the context length of the model. If you'd like to set a longer maxTokens or contextLength value you can do it like this:

{
      "provider": "ollama",
      "model": "dolphincoder",
      "title": "DolphinCoder",
      "contextLength": 2048,
      "completionOptions": {
        "maxTokens": 600
      }
    },

sestinj avatar Mar 19 '24 05:03 sestinj