turboderp / exllamav2

A fast inference library for running LLMs locally on modern consumer-class GPUs
MIT License
3.45k stars 257 forks source link

Chat code syntax highlighter has problems when out of view #190

Closed SinanAkkoyun closed 9 months ago

SinanAkkoyun commented 9 months ago
Sure, here is the complete code:

   import { Bot } from 'mineflayer';

   import { Bot } from 'mineflayer';
   import { statParser } from 'mineflayer-stat-parser';

   import { Bot } from 'mineflayer';
   import { statParser } from 'mineflayer-stat-parser';
   import MCVersion, { getLatestRelease } from '@frozenpandaman/mc-version';

   import { Bot } from 'mineflayer';
   import { statParser } from 'mineflayer-stat-parser';
   import MCVersion, { getLatestRelease } from '@frozenpandaman/mc-version';
   import fetch from 'node-fetch';

   import { Bot } from 'mineflayer';
   import { statParser } from 'mineflayer-stat-parser';
   import MCVersion, { getLatestRelease } from '@frozenpandaman/mc-version';
   import fetch from 'node-fetch';

   import { Bot } from 'mineflayer';
   import { statParser } from 'mineflayer-stat-parser';
   import MCVersion, { getLatestRelease } from '@frozenpandaman/mc-version';
   import fetch from 'node-fetch';

   const username = process.argv[2] || require('os').userinfo().username;

   import { Bot } from 'mineflayer';
   import { statParser } from 'mineflayer-stat-parser';
   import MCVersion, { getLatestRelease } from '@frozenpandaman/mc-version';
   import fetch from 'node-fetch';

   const username = process.argv[2] || require('os').userinfo().username;
   const hostname = 'gommesd.net';

   import { Bot } from 'mineflayer';
   import { statParser } from 'mineflayer-stat-parser';
   import MCVersion, { getLatestRelease } from '@frozenpandaman/mc-version';
   import fetch from 'node-fetch';

   const username = process.argv[2] || require('os').userinfo().username;
   const hostname = 'gommesd.net';
   const port = 25565;

   import { Bot } from 'mineflayer';
   import { statParser } from 'mineflayer-stat-parser';
   import MCVersion, { getLatestRelease } from '@frozenpandaman/mc-version';
   import fetch from 'node-fetch';

   const username = process.argv[2] || require('os').userinfo().username;
   const hostname = 'gommesd.net';
   const port = 25565;

   import { Bot } from 'mineflayer';
   import { statParser } from 'mineflayer-stat-parser';
   import MCVersion, { getLatestRelease } from '@frozenpandaman/mc-version';
   import fetch from 'node-fetch';

   const username = process.argv[2] || require('os').userinfo().username;
   const hostname = 'gommesd.net';
   const port = 25565;

   async function getServerStatus() {

   import { Bot } from 'mineflayer';
   import { statParser } from 'mineflayer-stat-parser';
   import MCVersion, { getLatestRelease } from '@frozenpandaman/mc-version';
   import fetch from 'node-fetch';

   const username = process.argv[2] || require('os').userinfo().username;
   const hostname = 'gommesd.net';
   const port = 25565;

   async function getServerStatus() {
      return await fetch(`https://api.mcsrv.eu/v2/server/${hostname}:${port}`)

   import { Bot } from 'mineflayer';
   import { statParser } from 'mineflayer-stat-parser';
   import MCVersion, { getLatestRelease } from '@frozenpandaman/mc-version';
   import fetch from 'node-fetch';

   const username = process.argv[2] || require('os').userinfo().username;
   const hostname = 'gommesd.net';
   const port = 25565;

   async function getServerStatus() {
      return await fetch(`https://api.mcsrv.eu/v2/server/${hostname}:${port}`)
          .then(response => response.json());

   import { Bot } from 'mineflayer';
   import { statParser } from 'mineflayer-stat-parser';
   import MCVersion, { getLatestRelease } from '@frozenpandaman/mc-version';
   import fetch from 'node-fetch';

   const username = process.argv[2] || require('os').userinfo().username;
   const hostname = 'gommesd.net';
   const port = 25565;

The rest of the code is normal. As long as the generated code is inside the terminal character size, code gen works flawlessly. However, when out of bounds, the top lines repeat as shown.

I just discovered it and had no time to further investigate, therefore I wanted to track the issue

SinanAkkoyun commented 9 months ago

It seems as if ANSI clearing of lines only works inside the terminal, I did not think about that when implementing the raw first version and never tested long code

https://github.com/turboderp/exllamav2/pull/191

SinanAkkoyun commented 9 months ago

The old lines somehow change the front padding, I am working on that rn

SinanAkkoyun commented 9 months ago

Just found some time to figure things out The PR is now done and works

SinanAkkoyun commented 9 months ago

(hasn't been merged yet)