Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes deepmipt/assistant/issues/39 #8

Open
wants to merge 14 commits into
base: feat/chat-rating
Choose a base branch
from
3 changes: 3 additions & 0 deletions robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
User-agent: *
Disallow: /

10 changes: 10 additions & 0 deletions src/components/skills/ChatSkill/ChatSkill.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@
}
}

.ratingDialogTitle {
text-align: center;
text-indent: 1rem;
font-size: 1rem;

.override {
margin-top: 0px !important;
}
}

.inputs {
flex-grow: 2;
flex-shrink: 0;
Expand Down
34 changes: 30 additions & 4 deletions src/components/skills/ChatSkill/ChatSkill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,35 @@ class ChatSkill extends Component<Props, State> {
const rest = { ...mes };
delete rest.answer;
delete rest.question;
const text = mes.answer;
let answer: any = mes.answer;
var idx;
var temp_dlg;
if (text.includes("#+#"))
{
idx = (text.indexOf("#") - 1);
answer = text.slice(0, idx);
}
if (text.includes("Oh, and remember this dialog's id: "))
{
temp_dlg = (text.indexOf("Oh, and remember this dialog's id: ") -1)
answer = text.slice(0, temp_dlg)
temp_dlg = temp_dlg + 36
}
return [
<div className={style.user} dir={this.isRTL(mes.question)} key={`question${i}`}>
<p>{mes.question}</p>
</div>,
<div className={style.bot} dir={this.isRTL(mes.question)} key={`answer${i}`}>
<p>{answer}</p>
</div>,
</div>
];
}

/*

moved from renderBasic
,
<div className={style.reaction} key={`reaction${i}`}>
{mes.rating === 0 &&
<div>
Expand All @@ -100,8 +121,8 @@ class ChatSkill extends Component<Props, State> {
{mes.rating === 1 && <span>&#x1f44d;</span>}
{mes.rating === 2 && <span>&#x1f44e;</span>}
</div>
];
}

*/

setUttRating = async (i: number, rating: number) => {
const { updateStore, answers, utteranceRating, dispatchLoading } = this.props;
Expand Down Expand Up @@ -293,7 +314,12 @@ class ChatSkill extends Component<Props, State> {
</button>
</div>
</div>
{dialog_id && <div className={style.rating}>{this.renderScore(rating)}</div>}
{dialog_id && <div>
<div className={style.ratingDialogTitle}>Rate Your Dialog:</div>
<div className={style.rating}>{this.renderScore(rating)}</div>
<div className={style.ratingDialogTitle}>Dialog Id: {dialog_id}</div>
<div className={style.ratingDialogTitle}><a href="https://deeppavlov.ai/feedbackdream/">Share Your Feedback With Us!</a></div>
</div>}

<button type="button" onClick={this.reset} className={style.button}>
{this.lang !== 'ru' ? 'Start new dialog' : 'Начать новый диалог'}
Expand Down
8 changes: 4 additions & 4 deletions src/components/skills/en/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import uuidv4 from 'uuid/v4';
import skillWrapper, { ChatSkillProps } from '../ChatSkill';
import { Res } from '../../../lib/api';

const apiUrl = 'https://7019.lnsigo.mipt.ru/';
const apiUrl = 'http://10.11.1.41:4242/'
// const apiUrl = 'https://7019.lnsigo.mipt.ru/';
const uid: string = uuidv4();

async function chatApi(text: string): Promise<Res> {
Expand Down Expand Up @@ -44,9 +45,8 @@ async function utteranceRating(utt_id: string, rating: number): Promise<Res> {
}

const config: ChatSkillProps<Res> = {
title: 'DREAM Socialbot',
desc: <div style={{ marginTop: '1em' }}>A virtual character able to provide entertainment with useful and funny facts,
as well as, engage its partner into a deeper discussion on topics of interest in a natural way.</div>,
title: 'DeepPavlov Dream AI Assistant',
desc: <div style={{ marginTop: '1em' }}>Welcome to DeepPavlov Dream AI Assistant demo! It shows how to blend goal-oriented and open domain skills inside a single AI assistant. It's under development and will learn new things over the time. You can also <a href="https://t.me/deeppavlov_dream_ai_bot">chat in Telegram</a>, and leave feedback in Telegram <a href="https://t.me/joinchat/CroEYRm2Oi12sC4EYxGUDQ">group</a> and via <a href="https://deeppavlov.ai/feedbackdream">feedback form</a>.</div>,
messageApi: chatApi,
resetApi: async () => await chatApi('/start'),
dialogRating,
Expand Down
Loading