mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-12-03 18:28:15 +00:00
feat(app): fix type resolving issues
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import z from 'zod';
|
import z from 'zod';
|
||||||
import { ResearchAction } from '../../types';
|
import { ResearchAction } from '../../types';
|
||||||
import { searchSearxng } from '@/lib/searxng';
|
import { searchSearxng } from '@/lib/searxng';
|
||||||
|
import { Chunk } from '@/lib/types';
|
||||||
|
|
||||||
const actionSchema = z.object({
|
const actionSchema = z.object({
|
||||||
type: z.literal('web_search'),
|
type: z.literal('web_search'),
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import z from 'zod';
|
|||||||
import BaseLLM from '../../models/base/llm';
|
import BaseLLM from '../../models/base/llm';
|
||||||
import BaseEmbedding from '@/lib/models/base/embedding';
|
import BaseEmbedding from '@/lib/models/base/embedding';
|
||||||
import SessionManager from '@/lib/session';
|
import SessionManager from '@/lib/session';
|
||||||
|
import { ChatTurnMessage, Chunk } from '@/lib/types';
|
||||||
|
|
||||||
export type SearchSources = 'web' | 'discussions' | 'academic';
|
export type SearchSources = 'web' | 'discussions' | 'academic';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { sql } from 'drizzle-orm';
|
import { sql } from 'drizzle-orm';
|
||||||
import { text, integer, sqliteTable } from 'drizzle-orm/sqlite-core';
|
import { text, integer, sqliteTable } from 'drizzle-orm/sqlite-core';
|
||||||
|
import { Block } from '../types';
|
||||||
|
|
||||||
export const messages = sqliteTable('messages', {
|
export const messages = sqliteTable('messages', {
|
||||||
id: integer('id').primaryKey(),
|
id: integer('id').primaryKey(),
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { Chunk } from '@/lib/types';
|
||||||
|
|
||||||
abstract class BaseEmbedding<CONFIG> {
|
abstract class BaseEmbedding<CONFIG> {
|
||||||
constructor(protected config: CONFIG) {}
|
constructor(protected config: CONFIG) {}
|
||||||
abstract embedText(texts: string[]): Promise<number[][]>;
|
abstract embedText(texts: string[]): Promise<number[][]>;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Ollama } from 'ollama';
|
import { Ollama } from 'ollama';
|
||||||
import BaseEmbedding from '../../base/embedding';
|
import BaseEmbedding from '../../base/embedding';
|
||||||
|
import { Chunk } from '@/lib/types';
|
||||||
|
|
||||||
type OllamaConfig = {
|
type OllamaConfig = {
|
||||||
model: string;
|
model: string;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import OpenAI from 'openai';
|
import OpenAI from 'openai';
|
||||||
import BaseEmbedding from '../../base/embedding';
|
import BaseEmbedding from '../../base/embedding';
|
||||||
|
import { Chunk } from '@/lib/types';
|
||||||
|
|
||||||
type OpenAIConfig = {
|
type OpenAIConfig = {
|
||||||
apiKey: string;
|
apiKey: string;
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import { ConfigModelProvider } from '../config/types';
|
import { ConfigModelProvider } from '../config/types';
|
||||||
import BaseModelProvider, {
|
import BaseModelProvider, { createProviderInstance } from './base/provider';
|
||||||
createProviderInstance,
|
|
||||||
} from './providers/baseProvider';
|
|
||||||
import { getConfiguredModelProviders } from '../config/serverRegistry';
|
import { getConfiguredModelProviders } from '../config/serverRegistry';
|
||||||
import { providers } from './providers';
|
import { providers } from './providers';
|
||||||
import { MinimalProvider, ModelList } from './types';
|
import { MinimalProvider, ModelList } from './types';
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import z from 'zod';
|
import z from 'zod';
|
||||||
|
import { ChatTurnMessage } from '../types';
|
||||||
|
|
||||||
type Model = {
|
type Model = {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -37,7 +38,7 @@ type GenerateOptions = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
type GenerateTextInput = {
|
type GenerateTextInput = {
|
||||||
messages: Message[];
|
messages: ChatTurnMessage[];
|
||||||
options?: GenerateOptions;
|
options?: GenerateOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@ type StreamTextOutput = {
|
|||||||
|
|
||||||
type GenerateObjectInput = {
|
type GenerateObjectInput = {
|
||||||
schema: z.ZodTypeAny;
|
schema: z.ZodTypeAny;
|
||||||
messages: Message[];
|
messages: ChatTurnMessage[];
|
||||||
options?: GenerateOptions;
|
options?: GenerateOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user