Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/input-history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type InputSource =
| {kind: InputSourceKind.SENTENCE_HISTORY; index: number}
| {kind: InputSourceKind.SNACK_BAR}
| {kind: InputSourceKind.SUGGESTED_SENTENCE; index: number}
| {kind: InputSourceKind.SUGGESTED_WORD}
| {kind: InputSourceKind.SUGGESTED_WORD};

export const InputSource: Record<string, InputSource> = {
BUTTON_BACKSPACE: {kind: InputSourceKind.BUTTON_BACKSPACE},
Expand Down
1 change: 0 additions & 1 deletion src/pv-app-css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,4 @@ export const pvAppStyle = css`
.input-row > pv-character-input {
flex: 1;
}

`;
15 changes: 4 additions & 11 deletions src/pv-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ import {customElement, property, query, queryAll} from 'lit/decorators.js';

import {AudioManager} from './audio-manager.js';
import {ConfigStorage} from './config-storage.js';
import {
CONFIG_DEFAULT,
LARGE_MARGIN_LINE_LIMIT,
} from './constants.js';
import {CONFIG_DEFAULT, LARGE_MARGIN_LINE_LIMIT} from './constants.js';
import {InputSource, InputSourceKind} from './input-history.js';
import {
SMALL_KANA_TRIGGER,
Expand Down Expand Up @@ -199,10 +196,9 @@ function splitLastFewSentencesForLLM(text: string) {
if (sentences.length === 0) {
return ['', ''];
}
const sentenceLengths = sentences.map(s => s.length);
let totalLength = 0;
for (let i = sentenceLengths.length - 1; i >= 0; i--) {
totalLength += sentenceLengths[i];
for (let i = sentences.length - 1; i >= 0; i--) {
totalLength += sentences[i].length;
if (totalLength >= MAX_SENTENCE_LENGTH_NICE_TO_LLM) {
return [sentences.slice(0, i).join(''), sentences.slice(i).join('')];
}
Expand Down Expand Up @@ -660,7 +656,7 @@ export class PvAppElement extends SignalWatcher(LitElement) {
Date.now() - CONVERSATION_HISTORY_MAX_AGE_MS,
CONVERSATION_HISTORY_MAX_TURNS,
);
let memoryKey = '';
const memoryKey = '';
const hasHistoryOrMemory = historyKey.length > 0 || memoryKey.length > 0;
const isBlankAtCall = this.isBlank();
const languageKey = this.stateInternal.lang.promptName;
Expand Down Expand Up @@ -968,15 +964,13 @@ export class PvAppElement extends SignalWatcher(LitElement) {
@undo-click=${this.onUndoClick}
@backspace-click=${this.onBackspaceClick}
@delete-click=${this.onDeleteClick}

@language-change-click=${this.onLanguageChangeClick}
@keyboard-change-click=${this.onKeyboardChangeClick}
@content-copy-click=${this.onContentCopyClick}
@setting-click=${this.onSettingClick}
@snackbar-close=${this.onSnackbarClose}
@output-speech-click=${this.updateConversationHistory}
@tts-end=${this.onTtsEnd}

></pv-functions-bar>
<div class="main">
${
Expand All @@ -999,7 +993,6 @@ export class PvAppElement extends SignalWatcher(LitElement) {
@character-select=${this.onCharacterSelect}
@keypad-handler-click=${this.onKeypadHandlerClick}
></pv-character-input>

</div>
<div class="suggestions">
<ul class="word-suggestions">
Expand Down
1 change: 0 additions & 1 deletion src/pv-functions-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ export class PvFunctionsBar extends SignalWatcher(LitElement) {
}

private startTts() {

const utterance = new SpeechSynthesisUtterance(this.state.text);
utterance.lang = this.state.lang.code;
utterance.rate = Math.pow(2, this.state.voiceSpeakingRate / 10);
Expand Down
8 changes: 1 addition & 7 deletions src/pv-setting-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ export class PvSettingPanel extends SignalWatcher(LitElement) {
.pv-initial-phrase-text-field {
width: 100%;
}

`;

@property({type: Number, reflect: true})
Expand Down Expand Up @@ -236,9 +235,7 @@ export class PvSettingPanel extends SignalWatcher(LitElement) {
</label>
</div>
</div>
<div class="form-section-column">

</div>
<div class="form-section-column"></div>
</div>
<div class="form-section">
<div>
Expand Down Expand Up @@ -307,7 +304,6 @@ export class PvSettingPanel extends SignalWatcher(LitElement) {
<div slot="headline">${voice.name}</div>
</md-select-option>`,
)}

</md-outlined-select>
</div>

Expand Down Expand Up @@ -372,8 +368,6 @@ export class PvSettingPanel extends SignalWatcher(LitElement) {
<md-primary-tab ?active="${this.activeSettingsTabIndex === 2}">
${msg('VOICE')}
</md-primary-tab>


</md-tabs>
${settingsPanels[this.activeSettingsTabIndex]}
</form>
Expand Down
Loading