<commit_before>import { Component, Input } from '@angular/core';
import { $WebSocket, WebSocketSendMode } from 'angular2-websocket/angular2-websocket'
import { Chat, Chats } from './chat_pb';
import { Door, Context } from 'ws-door';
import { Event, MethodEnum } from 'ws-door/event_pb';

@Component({
	selector: 'app-root',
	templateUrl: './app.component.html',
	styleUrls: ['./app.component.css']
})
export class AppComponent {
	@Input() nick: string;
	@Input() context: string;
	@Input() chats: Chat.AsObject[];
	private ws: $WebSocket;
	private door: Door;
	constructor() {
		console.log('event', Event);
		console.log('Door', Door);
		this.nick = '路人';
		this.context = '';
		this.chats = [];
		this.ws = new $WebSocket('ws://localhost:8888/ws');
		this.door = new Door();
		this.door.PUT('send', (c: Context) => {
			this.chats = c.toObject().chatsList;
		});
		this.door.POST('send', (c: Context) => {
			this.chats.push(c.toObject());
		});
		this.ws.onMessage((m: MessageEvent) => this.door.onMessage(m), {autoApply: false});
	}

	send() {
		console.log('text', this.context);
		const c = new Chat();
		c.setNick(this.nick);
		c.setContext(this.context);
		const e = new Event();
		e.setMethod(MethodEnum.POST);
		e.setPath('send');
		e.setData(c.serializeBinary());
		this.ws.send(e.serializeBinary(), WebSocketSendMode.Direct, true);
		this.context = '';
	}

	key(event: any) {
		if (event.keyCode === 13) {
			this.send()
		}
	}
}

function readFile (blob: Blob): Promise<ArrayBuffer> {<commit_msg>example<commit_after>import { Component, Input } from '@angular/core';
import { $WebSocket, WebSocketSendMode } from 'angular2-websocket/angular2-websocket'
import { Chat, Chats } from './chat_pb';
import { Door, Context } from 'ws-door';
import { Event, MethodEnum } from 'ws-door/event_pb';

@Component({
	selector: 'app-root',
	templateUrl: './app.component.html',
	styleUrls: ['./app.component.css']
})
export class AppComponent {
	@Input() nick: string;
	@Input() context: string;
	@Input() chats: Chat.AsObject[];
	private ws: $WebSocket;
	private door: Door;
	constructor() {
		console.log('event', Event);
		console.log('Door', Door);
		this.nick = '路人';
		this.context = '';
		this.chats = [];
		this.ws = new $WebSocket('ws://localhost:8888/ws');
		this.door = new Door();
		this.door.PUT('send', (c: Context) => {
			this.chats = c.toObject(Chats).chatsList;
		});
		this.door.POST('send', (c: Context) => {
			this.chats.push(c.toObject(Chat));
		});
		this.ws.onMessage((m: MessageEvent) => this.door.onMessage(m), {autoApply: false});
	}

	send() {
		console.log('text', this.context);
		const c = new Chat();
		c.setNick(this.nick);
		c.setContext(this.context);
		const e = new Event();
		e.setMethod(MethodEnum.POST);
		e.setPath('send');
		e.setData(c.serializeBinary());
		this.ws.send(e.serializeBinary(), WebSocketSendMode.Direct, true);
		this.context = '';
	}

	key(event: any) {
		if (event.keyCode === 13) {
			this.send()
		}
	}
}

function readFile (blob: Blob): Promise<ArrayBuffer> {
{'fraction_non_alphanumeric': 0.1959616021185038, 'fraction_numerical': 0.005296259516716319, 'mean_word_length': 4.2556521739130435, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7535488', 'n_tokens_mistral': 1168, 'n_tokens_neox': 1091, 'n_words': 220}