mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-11-22 13:08:14 +00:00
Compare commits
1 Commits
741bab1c76
...
dab0cdc251
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dab0cdc251 |
@@ -19,8 +19,6 @@ class LineOutputParser extends BaseOutputParser<string> {
|
||||
lc_namespace = ['langchain', 'output_parsers', 'line_output_parser'];
|
||||
|
||||
async parse(text: string): Promise<string> {
|
||||
text = text.trim() || '';
|
||||
|
||||
const regex = /^(\s*(-|\*|\d+\.\s|\d+\)\s|\u2022)\s*)+/;
|
||||
const startKeyIndex = text.indexOf(`<${this.key}>`);
|
||||
const endKeyIndex = text.indexOf(`</${this.key}>`);
|
||||
|
||||
@@ -19,13 +19,11 @@ class LineListOutputParser extends BaseOutputParser<string[]> {
|
||||
lc_namespace = ['langchain', 'output_parsers', 'line_list_output_parser'];
|
||||
|
||||
async parse(text: string): Promise<string[]> {
|
||||
text = text.trim() || '';
|
||||
|
||||
const regex = /^(\s*(-|\*|\d+\.\s|\d+\)\s|\u2022)\s*)+/;
|
||||
const startKeyIndex = text.indexOf(`<${this.key}>`);
|
||||
const endKeyIndex = text.indexOf(`</${this.key}>`);
|
||||
|
||||
if (startKeyIndex === -1 || endKeyIndex === -1) {
|
||||
if (startKeyIndex === -1 && endKeyIndex === -1) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@ const Chat = ({
|
||||
loading,
|
||||
messages,
|
||||
sendMessage,
|
||||
copilotEnabled,
|
||||
setCopilotEnabled,
|
||||
messageAppeared,
|
||||
rewrite,
|
||||
fileIds,
|
||||
@@ -20,8 +18,6 @@ const Chat = ({
|
||||
setFiles,
|
||||
}: {
|
||||
messages: Message[];
|
||||
copilotEnabled: boolean;
|
||||
setCopilotEnabled: (enable: boolean) => void;
|
||||
sendMessage: (message: string) => void;
|
||||
loading: boolean;
|
||||
messageAppeared: boolean;
|
||||
@@ -93,8 +89,6 @@ const Chat = ({
|
||||
<MessageInput
|
||||
loading={loading}
|
||||
sendMessage={sendMessage}
|
||||
copilotEnabled={copilotEnabled}
|
||||
setCopilotEnabled={setCopilotEnabled}
|
||||
fileIds={fileIds}
|
||||
setFileIds={setFileIds}
|
||||
files={files}
|
||||
|
||||
@@ -414,7 +414,6 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
||||
const [fileIds, setFileIds] = useState<string[]>([]);
|
||||
|
||||
const [focusMode, setFocusMode] = useState('webSearch');
|
||||
const [copilotEnabled, setCopilotEnabled] = useState(true);
|
||||
const [optimizationMode, setOptimizationMode] = useState('speed');
|
||||
|
||||
const [isMessagesLoaded, setIsMessagesLoaded] = useState(false);
|
||||
@@ -499,9 +498,8 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
||||
},
|
||||
files: fileIds,
|
||||
focusMode: focusMode,
|
||||
copilotEnabled:copilotEnabled,
|
||||
optimizationMode: optimizationMode,
|
||||
history: [...chatHistory],
|
||||
history: [...chatHistory, ['human', message]],
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -663,8 +661,6 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
||||
loading={loading}
|
||||
messages={messages}
|
||||
sendMessage={sendMessage}
|
||||
copilotEnabled={copilotEnabled}
|
||||
setCopilotEnabled={setCopilotEnabled}
|
||||
messageAppeared={messageAppeared}
|
||||
rewrite={rewrite}
|
||||
fileIds={fileIds}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import {cn} from '@/lib/utils';
|
||||
import {ArrowUp} from 'lucide-react';
|
||||
import {useEffect, useRef, useState} from 'react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { ArrowUp } from 'lucide-react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import TextareaAutosize from 'react-textarea-autosize';
|
||||
import Attach from './MessageInputActions/Attach';
|
||||
import CopilotToggle from './MessageInputActions/Copilot';
|
||||
import {File} from './ChatWindow';
|
||||
import { File } from './ChatWindow';
|
||||
import AttachSmall from './MessageInputActions/AttachSmall';
|
||||
|
||||
const MessageInput = ({
|
||||
sendMessage,
|
||||
copilotEnabled,
|
||||
setCopilotEnabled,
|
||||
loading,
|
||||
fileIds,
|
||||
setFileIds,
|
||||
@@ -17,14 +16,13 @@ const MessageInput = ({
|
||||
setFiles,
|
||||
}: {
|
||||
sendMessage: (message: string) => void;
|
||||
copilotEnabled: boolean;
|
||||
setCopilotEnabled: (enable: boolean) => void;
|
||||
loading: boolean;
|
||||
fileIds: string[];
|
||||
setFileIds: (fileIds: string[]) => void;
|
||||
files: File[];
|
||||
setFiles: (files: File[]) => void;
|
||||
}) => {
|
||||
const [copilotEnabled, setCopilotEnabled] = useState(false);
|
||||
const [message, setMessage] = useState('');
|
||||
const [textareaRows, setTextareaRows] = useState(1);
|
||||
const [mode, setMode] = useState<'multi' | 'single'>('single');
|
||||
|
||||
Reference in New Issue
Block a user