mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-23 19:46:42 +02:00
Fix wrong type
import, make auth and chat work
This commit is contained in:
parent
b8f9bc107c
commit
9c47119535
261 changed files with 24453 additions and 443 deletions
|
|
@ -1,8 +1,10 @@
|
|||
import { Body, Controller, Get, Post, UseGuards } from '@nestjs/common';
|
||||
import { isOk } from '@manacore/shared-errors';
|
||||
import { type ChatService } from './chat.service';
|
||||
import { type ChatCompletionDto, type ChatCompletionResponseDto } from './dto/chat-completion.dto';
|
||||
import { JwtAuthGuard, CurrentUser, type CurrentUserData } from '@manacore/shared-nestjs-auth';
|
||||
import { ChatService } from './chat.service';
|
||||
import { ChatCompletionDto } from './dto/chat-completion.dto';
|
||||
import type { ChatCompletionResponseDto } from './dto/chat-completion.dto';
|
||||
import { JwtAuthGuard, CurrentUser } from '@manacore/shared-nestjs-auth';
|
||||
import type { CurrentUserData } from '@manacore/shared-nestjs-auth';
|
||||
|
||||
@Controller('chat')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
import { Injectable, Inject, Logger } from '@nestjs/common';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { eq } from 'drizzle-orm';
|
||||
import { type AsyncResult, ok, err, ValidationError, ServiceError } from '@manacore/shared-errors';
|
||||
import { AsyncResult, ok, err, ValidationError, ServiceError } from '@manacore/shared-errors';
|
||||
import { GoogleGenerativeAI } from '@google/generative-ai';
|
||||
import { DATABASE_CONNECTION } from '../db/database.module';
|
||||
import { type Database } from '../db/connection';
|
||||
import { models, type Model } from '../db/schema/models.schema';
|
||||
import { type ChatCompletionDto, type ChatCompletionResponseDto } from './dto/chat-completion.dto';
|
||||
import { Database } from '../db/connection';
|
||||
import { models } from '../db/schema/models.schema';
|
||||
import type { Model } from '../db/schema/models.schema';
|
||||
import { ChatCompletionDto } from './dto/chat-completion.dto';
|
||||
import type { ChatCompletionResponseDto } from './dto/chat-completion.dto';
|
||||
|
||||
@Injectable()
|
||||
export class ChatService {
|
||||
|
|
|
|||
|
|
@ -10,10 +10,11 @@ import {
|
|||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { isOk } from '@manacore/shared-errors';
|
||||
import { type ConversationService } from './conversation.service';
|
||||
import { type Conversation } from '../db/schema/conversations.schema';
|
||||
import { type Message } from '../db/schema/messages.schema';
|
||||
import { JwtAuthGuard, CurrentUser, type CurrentUserData } from '@manacore/shared-nestjs-auth';
|
||||
import { ConversationService } from './conversation.service';
|
||||
import { Conversation } from '../db/schema/conversations.schema';
|
||||
import { Message } from '../db/schema/messages.schema';
|
||||
import { JwtAuthGuard, CurrentUser } from '@manacore/shared-nestjs-auth';
|
||||
import type { CurrentUserData } from '@manacore/shared-nestjs-auth';
|
||||
|
||||
@Controller('conversations')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
|
|
|
|||
|
|
@ -1,14 +1,12 @@
|
|||
import { Injectable, Inject, Logger } from '@nestjs/common';
|
||||
import { eq, and, desc, asc, sql } from 'drizzle-orm';
|
||||
import { type AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
|
||||
import { AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
|
||||
import { DATABASE_CONNECTION } from '../db/database.module';
|
||||
import { type Database } from '../db/connection';
|
||||
import {
|
||||
conversations,
|
||||
type Conversation,
|
||||
type NewConversation,
|
||||
} from '../db/schema/conversations.schema';
|
||||
import { messages, type Message, type NewMessage } from '../db/schema/messages.schema';
|
||||
import { Database } from '../db/connection';
|
||||
import { conversations } from '../db/schema/conversations.schema';
|
||||
import type { Conversation, NewConversation } from '../db/schema/conversations.schema';
|
||||
import { messages } from '../db/schema/messages.schema';
|
||||
import type { Message, NewMessage } from '../db/schema/messages.schema';
|
||||
|
||||
@Injectable()
|
||||
export class ConversationService {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import { Module, Global, type OnModuleDestroy } from '@nestjs/common';
|
||||
import { Module, Global } from '@nestjs/common';
|
||||
import type { OnModuleDestroy } from '@nestjs/common';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { getDb, closeConnection, type Database } from './connection';
|
||||
import { getDb, closeConnection } from './connection';
|
||||
import type { Database } from './connection';
|
||||
|
||||
export const DATABASE_CONNECTION = 'DATABASE_CONNECTION';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import { Body, Controller, Delete, Get, Param, Post, UseGuards } from '@nestjs/common';
|
||||
import { isOk } from '@manacore/shared-errors';
|
||||
import { type DocumentService } from './document.service';
|
||||
import { type Document } from '../db/schema/documents.schema';
|
||||
import { JwtAuthGuard, CurrentUser, type CurrentUserData } from '@manacore/shared-nestjs-auth';
|
||||
import { DocumentService } from './document.service';
|
||||
import { Document } from '../db/schema/documents.schema';
|
||||
import { JwtAuthGuard, CurrentUser } from '@manacore/shared-nestjs-auth';
|
||||
import type { CurrentUserData } from '@manacore/shared-nestjs-auth';
|
||||
|
||||
@Controller('documents')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { Injectable, Inject, Logger } from '@nestjs/common';
|
||||
import { eq, and, desc, sql } from 'drizzle-orm';
|
||||
import { type AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
|
||||
import { AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
|
||||
import { DATABASE_CONNECTION } from '../db/database.module';
|
||||
import { type Database } from '../db/connection';
|
||||
import { documents, type Document, type NewDocument } from '../db/schema/documents.schema';
|
||||
import { Database } from '../db/connection';
|
||||
import { documents, Document, NewDocument } from '../db/schema/documents.schema';
|
||||
import { conversations } from '../db/schema/conversations.schema';
|
||||
|
||||
@Injectable()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { Controller, Get, Param } from '@nestjs/common';
|
||||
import { isOk } from '@manacore/shared-errors';
|
||||
import { type ModelService } from './model.service';
|
||||
import { type Model } from '../db/schema/models.schema';
|
||||
import { ModelService } from './model.service';
|
||||
import { Model } from '../db/schema/models.schema';
|
||||
|
||||
// Models are publicly accessible - no auth required to list available models
|
||||
@Controller('models')
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import { Injectable, Inject, Logger } from '@nestjs/common';
|
||||
import { eq, asc } from 'drizzle-orm';
|
||||
import { type AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
|
||||
import { AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
|
||||
import { DATABASE_CONNECTION } from '../db/database.module';
|
||||
import { type Database } from '../db/connection';
|
||||
import { models, type Model } from '../db/schema/models.schema';
|
||||
import { Database } from '../db/connection';
|
||||
import { models } from '../db/schema/models.schema';
|
||||
import type { Model } from '../db/schema/models.schema';
|
||||
|
||||
@Injectable()
|
||||
export class ModelService {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
import { Body, Controller, Delete, Get, Param, Patch, Post, UseGuards } from '@nestjs/common';
|
||||
import { isOk } from '@manacore/shared-errors';
|
||||
import { type SpaceService } from './space.service';
|
||||
import { type Space, type SpaceMember } from '../db/schema/spaces.schema';
|
||||
import { JwtAuthGuard, CurrentUser, type CurrentUserData } from '@manacore/shared-nestjs-auth';
|
||||
import { SpaceService } from './space.service';
|
||||
import { Space } from '../db/schema/spaces.schema';
|
||||
import type { SpaceMember } from '../db/schema/spaces.schema';
|
||||
import { JwtAuthGuard, CurrentUser } from '@manacore/shared-nestjs-auth';
|
||||
import type { CurrentUserData } from '@manacore/shared-nestjs-auth';
|
||||
|
||||
@Controller('spaces')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { Injectable, Inject, Logger } from '@nestjs/common';
|
||||
import { eq, and, desc, inArray } from 'drizzle-orm';
|
||||
import { type AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
|
||||
import { AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
|
||||
import { DATABASE_CONNECTION } from '../db/database.module';
|
||||
import { type Database } from '../db/connection';
|
||||
import { Database } from '../db/connection';
|
||||
import {
|
||||
spaces,
|
||||
spaceMembers,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import { Body, Controller, Delete, Get, Param, Patch, Post, UseGuards } from '@nestjs/common';
|
||||
import { isOk } from '@manacore/shared-errors';
|
||||
import { type TemplateService } from './template.service';
|
||||
import { type Template } from '../db/schema/templates.schema';
|
||||
import { JwtAuthGuard, CurrentUser, type CurrentUserData } from '@manacore/shared-nestjs-auth';
|
||||
import { TemplateService } from './template.service';
|
||||
import { Template } from '../db/schema/templates.schema';
|
||||
import { JwtAuthGuard, CurrentUser } from '@manacore/shared-nestjs-auth';
|
||||
import type { CurrentUserData } from '@manacore/shared-nestjs-auth';
|
||||
|
||||
@Controller('templates')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import { Injectable, Inject, Logger } from '@nestjs/common';
|
||||
import { eq, and, asc } from 'drizzle-orm';
|
||||
import { type AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
|
||||
import { AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
|
||||
import { DATABASE_CONNECTION } from '../db/database.module';
|
||||
import { type Database } from '../db/connection';
|
||||
import { templates, type Template, type NewTemplate } from '../db/schema/templates.schema';
|
||||
import { Database } from '../db/connection';
|
||||
import { templates } from '../db/schema/templates.schema';
|
||||
import type { Template, NewTemplate } from '../db/schema/templates.schema';
|
||||
|
||||
@Injectable()
|
||||
export class TemplateService {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
/**
|
||||
* Document Service - CRUD operations via Backend API
|
||||
*/
|
||||
import { documentApi, type Document as ApiDocument } from './api';
|
||||
import { documentApi } from './api';
|
||||
import type { Document as ApiDocument } from './api';
|
||||
|
||||
// Re-export type with backwards-compatible naming (snake_case for mobile)
|
||||
export interface Document {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
* This service wraps the backend API for AI completions
|
||||
*/
|
||||
import { availableModels } from '../config/azure';
|
||||
import { chatApi, modelApi, usageApi, type ChatMessage, type TokenUsage } from './api';
|
||||
import { chatApi, modelApi, usageApi } from './api';
|
||||
import type { ChatMessage, TokenUsage } from './api';
|
||||
|
||||
// Re-export types for backward compatibility
|
||||
export type { ChatMessage };
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
/**
|
||||
* Space Service - CRUD operations via Backend API
|
||||
*/
|
||||
import { spaceApi, type Space as ApiSpace, type SpaceMember as ApiSpaceMember } from './api';
|
||||
import { spaceApi } from './api';
|
||||
import type { Space as ApiSpace, SpaceMember as ApiSpaceMember } from './api';
|
||||
|
||||
// Re-export types with backwards-compatible naming (snake_case for mobile)
|
||||
export type Space = {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
/**
|
||||
* Template Service - CRUD operations via Backend API
|
||||
*/
|
||||
import { templateApi, type Template as ApiTemplate } from './api';
|
||||
import { templateApi } from './api';
|
||||
import type { Template as ApiTemplate } from './api';
|
||||
|
||||
// Re-export type with backwards-compatible naming (snake_case for mobile)
|
||||
export interface Template {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<script lang="ts">
|
||||
import { AppSlider, type AppItem } from '@manacore/shared-ui';
|
||||
import { AppSlider } from '@manacore/shared-ui';
|
||||
import type { AppItem } from '@manacore/shared-ui';
|
||||
import { MANA_APPS, APP_STATUS_LABELS, APP_SLIDER_LABELS } from '@manacore/shared-branding';
|
||||
|
||||
// Convert MANA_APPS to AppItem format (German)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<script lang="ts">
|
||||
import { toastStore, type Toast } from '$lib/stores/toast.svelte';
|
||||
import { toastStore } from '$lib/stores/toast.svelte';
|
||||
import type { Toast } from '$lib/stores/toast.svelte';
|
||||
import { X, CheckCircle, XCircle, Warning, Info } from '@manacore/shared-icons';
|
||||
|
||||
let toasts = $derived(toastStore.toasts);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@
|
|||
* so we don't need to pass it from the frontend.
|
||||
*/
|
||||
|
||||
import { conversationApi, chatApi, type Conversation, type Message, type ChatMessage } from './api';
|
||||
import { conversationApi, chatApi } from './api';
|
||||
import type { Conversation, Message, ChatMessage } from './api';
|
||||
|
||||
export type { Conversation, Message };
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
* Document Service - CRUD operations via Backend API
|
||||
*/
|
||||
|
||||
import { documentApi, conversationApi, type Document } from './api';
|
||||
import { documentApi, conversationApi } from './api';
|
||||
import type { Document } from './api';
|
||||
|
||||
export type { Document };
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
* Space Service - CRUD operations via Backend API
|
||||
*/
|
||||
|
||||
import { spaceApi, type Space, type SpaceMember } from './api';
|
||||
import { spaceApi } from './api';
|
||||
import type { Space, SpaceMember } from './api';
|
||||
|
||||
export type { Space, SpaceMember };
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
* Template Service - CRUD operations via Backend API
|
||||
*/
|
||||
|
||||
import { templateApi, type Template } from './api';
|
||||
import { templateApi } from './api';
|
||||
import type { Template } from './api';
|
||||
|
||||
export type { Template };
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
*/
|
||||
|
||||
import { browser } from '$app/environment';
|
||||
import { initializeWebAuth, type UserData } from '@manacore/shared-auth';
|
||||
import { initializeWebAuth } from '@manacore/shared-auth';
|
||||
import type { UserData } from '@manacore/shared-auth';
|
||||
import { PUBLIC_MANA_CORE_AUTH_URL } from '$env/static/public';
|
||||
|
||||
// Initialize Mana Core Auth only on the client side
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
* Chat Store - Manages current chat state using Svelte 5 runes
|
||||
*/
|
||||
|
||||
import { chatService, type ChatCompletionRequest } from '$lib/services/chat';
|
||||
import { chatService } from '$lib/services/chat';
|
||||
import type { ChatCompletionRequest } from '$lib/services/chat';
|
||||
import type { Message, AIModel, ChatMessage } from '@chat/types';
|
||||
|
||||
// State
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
import { onMount } from 'svelte';
|
||||
import { theme } from '$lib/stores/theme';
|
||||
import { userSettings } from '$lib/stores/user-settings.svelte';
|
||||
import { THEME_DEFINITIONS, type ThemeVariant } from '@manacore/shared-theme';
|
||||
import { THEME_DEFINITIONS } from '@manacore/shared-theme';
|
||||
import type { ThemeVariant } from '@manacore/shared-theme';
|
||||
import {
|
||||
SettingsPage,
|
||||
SettingsSection,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue