Skip to content

Commit 62ed8dd

Browse files
committed
Merge branch 'release/README-Chanages'
2 parents 57ddfa7 + a5d2d9c commit 62ed8dd

File tree

7 files changed

+33
-5
lines changed

7 files changed

+33
-5
lines changed

.gitlab-ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ master_build:
3939
<<: *build_template
4040
only:
4141
- master
42-
- tags
4342
artifacts:
4443
expire_in: 1 month
4544
paths:

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# DBpedia Chatbot
22

3-
## [GSoC Wiki](https://github.com/dbpedia/chatbot/wiki/GSoC-2017:-Chatbot-for-DBpedia)
3+
[![BCH compliance](https://bettercodehub.com/edge/badge/dbpedia/chatbot?branch=master)](https://bettercodehub.com/)
4+
5+
For more information about this project and **GSoC Progress** please refer to [GSoC Wiki](https://github.com/dbpedia/chatbot/wiki/GSoC-2017:-Chatbot-for-DBpedia)
46

57
## Environment Configurations
68
admin.username = <admin-username>
@@ -35,3 +37,22 @@
3537
## Development
3638
mvn spring-boot:run
3739
node/node node_modules/.bin/webpack --watch
40+
41+
## Embed Code
42+
Add the following snippet to the `<head>` section of the webpage where you want to embed the ChatBot.
43+
``` javascript
44+
<script type="text/javascript">
45+
window.onload = function() {
46+
var iframe = document.createElement("iframe");
47+
iframe.setAttribute("src", "http://chat.dbpedia.org/embed");
48+
iframe.setAttribute("frameBorder", 0);
49+
iframe.style.zIndex = 10000000;
50+
iframe.style.height = "100%";
51+
iframe.style.width = "40%";
52+
iframe.style.position = "fixed";
53+
iframe.style.bottom = "20px";
54+
iframe.style.right = "20px";
55+
document.body.appendChild(iframe);
56+
}
57+
</script>
58+
```

app/src/js/components/embed/Embed.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Embed extends React.Component {
2626
</div>
2727
</div>
2828
<div className="embed-chat-button-container">
29-
<a className="embed-chat-button btn btn-raised btn-fab btn-primary" onClick={this.toggleChat}>
29+
<a className="embed-chat-button btn btn-raised btn-fab" onClick={this.toggleChat}>
3030
<i className="material-icons">
3131
{this.state.isChatOpen ? "clear" : "chat"}
3232
</i>

app/src/less/pages/embed.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ html, body {
2626
.embed-chat-button {
2727
left: 100% !important;
2828
margin-left: -56px !important;
29+
background: @brand-secondary !important;
2930
}

src/main/java/chatbot/Application.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ protected void configure(HttpSecurity http) throws Exception {
7979
.and()
8080
.logout()
8181
.permitAll();
82+
http.headers().frameOptions().disable();
8283
}
8384

8485
@Autowired

src/main/java/chatbot/lib/api/dbpedia/GenesisService.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ public GenesisService() {
3333
client = HttpClientBuilder.create().setDefaultRequestConfig(requestConfig).build();
3434
}
3535

36+
// Created for tests since they fail because Genesis cannot produce results before timeout occurs
37+
public GenesisService(int timeout) {
38+
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).build();
39+
client = HttpClientBuilder.create().setDefaultRequestConfig(requestConfig).build();
40+
}
41+
3642
private String makeRequest(String endpoint, String uri, String requestType) {
3743
try {
3844
HttpPost httpPost = new HttpPost(endpoint);

src/test/java/chatbot/lib/api/dbpedia/TestGenesisService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
public class TestGenesisService {
1616
@Test
1717
public void checkSimilar() throws Exception {
18-
String uris = new GenesisService().getSimilarEntities("http://dbpedia.org/resource/Barack_Obama");
18+
String uris = new GenesisService(0).getSimilarEntities("http://dbpedia.org/resource/Barack_Obama");
1919
assertNotNull(uris);
2020
assertNotEquals(uris.trim(), "");
2121
}
2222

2323
@Test
2424
public void checkRelated() throws Exception {
25-
String uris = new GenesisService().getRelatedEntities("http://dbpedia.org/resource/Barack_Obama");
25+
String uris = new GenesisService(0).getRelatedEntities("http://dbpedia.org/resource/Barack_Obama");
2626
assertNotNull(uris);
2727
assertNotEquals(uris.trim(), "");
2828
}

0 commit comments

Comments
 (0)