-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix various bindings to conversation IDs
- Loading branch information
1 parent
ded22a6
commit bddf597
Showing
14 changed files
with
204 additions
and
59 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
'use strict'; | ||
|
||
// Dependencies | ||
const React = require('react'); | ||
|
||
// Semantic UI | ||
const { | ||
Header, | ||
Segment | ||
} = require('semantic-ui-react'); | ||
|
||
// Fabric Types | ||
const Actor = require('@fabric/core/types/actor'); | ||
|
||
// Local Components | ||
const ChatBox = require('./ChatBox'); | ||
|
||
// TODO: reduce to a web component (no react) | ||
class SourceHome extends React.Component { | ||
constructor (props) { | ||
super(props); | ||
|
||
// Settings | ||
this.creation = new Date(); | ||
this.settings = Object.assign({ | ||
clock: 0, | ||
debug: false, | ||
interval: 1000 | ||
}, props); | ||
|
||
// State | ||
this.heart = null; | ||
this.style = this.props.style || {}; | ||
this.state = { | ||
content: { | ||
clock: this.settings.clock, | ||
interval: this.settings.interval | ||
} | ||
}; | ||
|
||
// Fabric State | ||
this._state = { | ||
content: JSON.parse(JSON.stringify(this.state)) | ||
}; | ||
|
||
return this; | ||
} | ||
|
||
// TODO: reconcile with Fabric API | ||
commit () { | ||
return new Actor({ | ||
content: this._state.content | ||
}); | ||
} | ||
|
||
componentDidMount () { | ||
this.start(); | ||
} | ||
|
||
render () { | ||
const now = new Date(); | ||
const { sources } = this.props; | ||
return ( | ||
<Segment className='fade-in' loading={sources?.loading} style={{ maxHeight: '100%', height: '97vh' }}> | ||
<Header as='h1'>Sources</Header> | ||
<p>Remote data sources can be added to improve coverage.</p> | ||
<ChatBox {...this.props} context={{ sources: sources?.current }} placeholder='Ask about these sources...' /> | ||
</Segment> | ||
); | ||
} | ||
|
||
start () { | ||
this._state.content.status = 'STARTING'; | ||
// this.heart = setInterval(this.tick.bind(this), this.settings.interval); | ||
this._state.content.status = 'STARTED'; | ||
this.commit(); | ||
} | ||
|
||
stop () { | ||
this._state.content.status = 'STOPPING'; | ||
clearInterval(this.heart); | ||
this._state.content.status = 'STOPPED'; | ||
this.commit(); | ||
} | ||
} | ||
|
||
module.exports = SourceHome; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.