<commit_before>import React from 'react';
import Navbar from '../component/navbar';
import NavHeading from './navheading';
import NavBody from './navbody';
import ChatWindow from './chatwindow';
import {getUserData} from '../server';
import {getMessages} from '../server';
import ChatRightBubble from './chatrightbubble';
import ChatLeftBubble from './chatleftbubble';

export default class Chat extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
          user: {}
        ,
          message :{}
        };
    }

    getData() {
        getUserData(this.props.user, (userData) => {
            this.setState({user:userData});
        });
        getMessages(1,(message)=>{
          this.setState({message: message})
        })

    }
    handlePostMessage(message){
      postMessage(this.props.userdata._id, this.props.target ,message, (newMessage)=>{
        this.setState({message:newMessage});
      })
    }

    render() {
        return (
            <div>
                <Navbar chat="active" user={this.state.user}/>
                <div className="container">
                    <div className="row">
                        <div className="col-md-4 col-sm-4 col-xs-4 col-md-offset-1 col-sm-offset-1 col-xs-offset-1 chat-left">
                            <div className="panel panel-dafault">
                                <NavHeading chat="active"/>
                                <NavBody data={this.state.user}/>
                            </div>
                        </div>

                          <ChatWindow userdata={this.state.user} messages={this.state.message} target={2} onPost={(message)=>this.handlePostMessage(message)}>



                                  {this.state.message.messages === undefined ? 0:this.state.message.messages.map((message,i)=>{
                                    if(message.sender==this.state.user._id){
                                    return (
                                      <ChatRightBubble key={i} data={message} /><commit_msg>update chat<commit_after>import React from 'react';
import Navbar from '../component/navbar';
import NavHeading from './navheading';
import NavBody from './navbody';
import ChatWindow from './chatwindow';
import {getUserData} from '../server';
import {getMessages} from '../server';
import ChatRightBubble from './chatrightbubble';
import ChatLeftBubble from './chatleftbubble';

export default class Chat extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
          user: {}
        ,
          message :{}
        };
    }

    getData() {
        getUserData(this.props.user, (userData) => {
            this.setState({user:userData});
        });
        getMessages(1,(message)=>{
          this.setState({message: message})
        })

    }
    handlePostMessage(message){
      postMessage(this.props.userdata._id, this.props.target ,message, (newMessage)=>{
        this.setState({message:newMessage});
      })
    }

    render() {
        return (
            <div>
                <Navbar chat="active" user={this.state.user}/>
                <div className="container">
                    <div className="row">
                        <div className="col-md-4 col-sm-4 col-xs-4 col-md-offset-1 col-sm-offset-1 col-xs-offset-1 chat-left">
                            <div className="panel panel-dafault">
                                <NavHeading chat="active"/>
                                <NavBody data={this.state.user}/>
                            </div>
                        </div>

                          <ChatWindow userdata={this.state.user} messages={this.state.message} length={this.state.message.length} target={2} onPost={(message)=>this.handlePostMessage(message)}>



                                  {this.state.message.messages === undefined ? 0:this.state.message.messages.map((message,i)=>{
                                    if(message.sender==this.state.user._id){
                                    return (
                                      <ChatRightBubble key={i} data={message} />
{'fraction_non_alphanumeric': 0.1358472322939328, 'fraction_numerical': 0.00435097897026831, 'mean_word_length': 1.6800518134715026, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '59793', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1060, 'n_words': 202}