Instructions to use luclima/mythos-models with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use luclima/mythos-models with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf luclima/mythos-models:Q4_K_M # Run inference directly in the terminal: llama cli -hf luclima/mythos-models:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf luclima/mythos-models:Q4_K_M # Run inference directly in the terminal: llama cli -hf luclima/mythos-models:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf luclima/mythos-models:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf luclima/mythos-models:Q4_K_M
Use Docker
docker model run hf.co/luclima/mythos-models:Q4_K_M
- Llama new
- LM Studio
- Jan
- Ollama
How to use luclima/mythos-models with Ollama:
ollama run hf.co/luclima/mythos-models:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use luclima/mythos-models with Docker Model Runner:
docker model run hf.co/luclima/mythos-models:Q4_K_M
- Lemonade
How to use luclima/mythos-models with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull luclima/mythos-models:Q4_K_M
Run and chat with the model
lemonade run user.mythos-models-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Upload folder using huggingface_hub (part 3)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +3 -0
- global_ai/canada/cohere-toolkit/src/community/tools/wolfram.py +52 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.env.development +9 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.env.production +9 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.eslintrc.js +13 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.gitignore +28 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.npmrc +1 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.nvmrc +1 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.prettierignore +2 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.prettierrc.js +13 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.storybook/main.ts +30 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.storybook/preview.tsx +37 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/Dockerfile +32 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/README.md +31 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/next-env.d.ts +5 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/next.config.mjs +43 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/openapi-ts.config.ts +13 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/package-lock.json +0 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/package.json +128 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/patches/react-scroll-to-bottom+4.2.0.patch +295 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/postcss.config.js +8 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/favicon.ico +0 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/android-chrome-192x192.png +0 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/android-chrome-512x512.png +0 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/apple-touch-icon.png +0 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/favicon-16x16.png +0 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/favicon-32x32.png +0 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/kycCellBackground.png +3 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/mushroom-filled-icon-512x512.png +0 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/share.png +3 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/white-filled-icon-512x512.png +0 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/site.webmanifest +32 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/videos/KYC_BG_5K.mp4 +3 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(auth)/auth/[strategy]/OauthCallback.tsx +77 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(auth)/auth/[strategy]/page.tsx +14 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(auth)/layout.tsx +7 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(auth)/login/Login.tsx +172 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(auth)/login/page.tsx +13 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(auth)/logout/Logout.tsx +33 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(auth)/logout/page.tsx +13 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(auth)/register/Register.tsx +123 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(auth)/register/page.tsx +18 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(main)/(chat)/Chat.tsx +119 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(main)/(chat)/a/[agentId]/c/[conversationId]/loading.tsx +11 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(main)/(chat)/a/[agentId]/c/[conversationId]/page.tsx +38 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(main)/(chat)/a/[agentId]/loading.tsx +11 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(main)/(chat)/a/[agentId]/page.tsx +30 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(main)/(chat)/c/[conversationId]/loading.tsx +11 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(main)/(chat)/c/[conversationId]/page.tsx +38 -0
- global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(main)/(chat)/layout.tsx +63 -0
.gitattributes
CHANGED
|
@@ -902,3 +902,6 @@ global_ai/canada/cohere-toolkit/src/backend/tests/unit/test_data/Cardistry.pdf f
|
|
| 902 |
global_ai/canada/cohere-toolkit/src/backend/tests/unit/test_data/Mariana_Trench.pdf filter=lfs diff=lfs merge=lfs -text
|
| 903 |
global_ai/canada/cohere-toolkit/src/backend/tests/unit/test_data/Mount_Everest.pdf filter=lfs diff=lfs merge=lfs -text
|
| 904 |
global_ai/canada/cohere-toolkit/src/backend/tests/unit/test_data/Tapas.pdf filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 902 |
global_ai/canada/cohere-toolkit/src/backend/tests/unit/test_data/Mariana_Trench.pdf filter=lfs diff=lfs merge=lfs -text
|
| 903 |
global_ai/canada/cohere-toolkit/src/backend/tests/unit/test_data/Mount_Everest.pdf filter=lfs diff=lfs merge=lfs -text
|
| 904 |
global_ai/canada/cohere-toolkit/src/backend/tests/unit/test_data/Tapas.pdf filter=lfs diff=lfs merge=lfs -text
|
| 905 |
+
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/kycCellBackground.png filter=lfs diff=lfs merge=lfs -text
|
| 906 |
+
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/share.png filter=lfs diff=lfs merge=lfs -text
|
| 907 |
+
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/videos/KYC_BG_5K.mp4 filter=lfs diff=lfs merge=lfs -text
|
global_ai/canada/cohere-toolkit/src/community/tools/wolfram.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any
|
| 2 |
+
|
| 3 |
+
from langchain_community.utilities.wolfram_alpha import WolframAlphaAPIWrapper
|
| 4 |
+
|
| 5 |
+
from backend.config.settings import Settings
|
| 6 |
+
from backend.schemas.tool import ToolCategory, ToolDefinition
|
| 7 |
+
from backend.tools.base import BaseTool
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class WolframAlpha(BaseTool):
|
| 11 |
+
"""
|
| 12 |
+
Wolfram Alpha tool.
|
| 13 |
+
|
| 14 |
+
See: https://python.langchain.com/docs/integrations/tools/wolfram_alpha/
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
ID = "wolfram_alpha"
|
| 18 |
+
|
| 19 |
+
wolfram_app_id = Settings().get('tools.wolfram_alpha.app_id')
|
| 20 |
+
|
| 21 |
+
def __init__(self):
|
| 22 |
+
self.app_id = self.wolfram_app_id
|
| 23 |
+
self.tool = WolframAlphaAPIWrapper(wolfram_alpha_appid=self.app_id)
|
| 24 |
+
|
| 25 |
+
@classmethod
|
| 26 |
+
def is_available(cls) -> bool:
|
| 27 |
+
return cls.wolfram_app_id is not None
|
| 28 |
+
|
| 29 |
+
@classmethod
|
| 30 |
+
def get_tool_definition(cls) -> ToolDefinition:
|
| 31 |
+
return ToolDefinition(
|
| 32 |
+
name=cls.ID,
|
| 33 |
+
display_name="Wolfram Alpha",
|
| 34 |
+
implementation=cls,
|
| 35 |
+
is_visible=True,
|
| 36 |
+
is_available=cls.is_available(),
|
| 37 |
+
error_message=cls.generate_error_message(),
|
| 38 |
+
category=ToolCategory.Function,
|
| 39 |
+
description="Evaluate arithmetic expressions using Wolfram Alpha.",
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
async def call(self, parameters: dict, **kwargs: Any) -> list[dict[str, Any]]:
|
| 43 |
+
to_evaluate = parameters.get("expression", "")
|
| 44 |
+
try:
|
| 45 |
+
result = self.tool.run(to_evaluate)
|
| 46 |
+
except Exception as e:
|
| 47 |
+
return self.get_tool_error(details=str(e))
|
| 48 |
+
|
| 49 |
+
if not result:
|
| 50 |
+
return self.get_no_results_error()
|
| 51 |
+
|
| 52 |
+
return [{"result": result, "text": result}]
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.env.development
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Server
|
| 2 |
+
API_HOSTNAME=http://backend:8000
|
| 3 |
+
|
| 4 |
+
# Client
|
| 5 |
+
NEXT_PUBLIC_API_HOSTNAME=http://localhost:8000
|
| 6 |
+
NEXT_PUBLIC_FRONTEND_HOSTNAME=http://localhost:4000
|
| 7 |
+
NEXT_PUBLIC_HAS_CUSTOM_LOGO=false
|
| 8 |
+
NEXT_PUBLIC_GOOGLE_DRIVE_CLIENT_ID='client-id'
|
| 9 |
+
NEXT_PUBLIC_GOOGLE_DRIVE_DEVELOPER_KEY='developer-key'
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.env.production
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Server
|
| 2 |
+
API_HOSTNAME=http://backend:8000
|
| 3 |
+
|
| 4 |
+
# Client
|
| 5 |
+
NEXT_PUBLIC_API_HOSTNAME=http://localhost:8000
|
| 6 |
+
NEXT_PUBLIC_FRONTEND_HOSTNAME=http://localhost:4000
|
| 7 |
+
NEXT_PUBLIC_HAS_CUSTOM_LOGO=false
|
| 8 |
+
NEXT_PUBLIC_GOOGLE_DRIVE_CLIENT_ID='client-id'
|
| 9 |
+
NEXT_PUBLIC_GOOGLE_DRIVE_DEVELOPER_KEY='developer-key'
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.eslintrc.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module.exports = {
|
| 2 |
+
extends: [
|
| 3 |
+
'eslint-config-next/core-web-vitals',
|
| 4 |
+
'eslint-config-prettier',
|
| 5 |
+
'plugin:storybook/recommended',
|
| 6 |
+
],
|
| 7 |
+
rules: {
|
| 8 |
+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
| 9 |
+
'no-process-env': 'error',
|
| 10 |
+
},
|
| 11 |
+
parser: '@typescript-eslint/parser',
|
| 12 |
+
plugins: ['@typescript-eslint'],
|
| 13 |
+
};
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.gitignore
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# dependencies
|
| 2 |
+
node_modules
|
| 3 |
+
|
| 4 |
+
# next.js
|
| 5 |
+
.next/
|
| 6 |
+
out/
|
| 7 |
+
build
|
| 8 |
+
dist
|
| 9 |
+
|
| 10 |
+
# vscode settings
|
| 11 |
+
.vscode/
|
| 12 |
+
|
| 13 |
+
# debug
|
| 14 |
+
.pnpm-debug.log*
|
| 15 |
+
|
| 16 |
+
# local env files
|
| 17 |
+
.env.development.local
|
| 18 |
+
.env.test.local
|
| 19 |
+
.env.production.local
|
| 20 |
+
.env.local
|
| 21 |
+
|
| 22 |
+
# typescript
|
| 23 |
+
*.tsbuildinfo
|
| 24 |
+
|
| 25 |
+
# package manager lock files not supported
|
| 26 |
+
yarn.lock
|
| 27 |
+
pnpm-lock.yaml
|
| 28 |
+
*storybook.log
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.npmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
engine-strict=true
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
v20.12.2
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.prettierignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.next/
|
| 2 |
+
src/assets/lotties/*.json
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.prettierrc.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// https://prettier.io/docs/en/options.html
|
| 2 |
+
|
| 3 |
+
module.exports = {
|
| 4 |
+
printWidth: 100,
|
| 5 |
+
singleQuote: true,
|
| 6 |
+
importOrder: ['<THIRD_PARTY_MODULES>', '^@/*/(.*)$', '^[./]', '(.*)\\.css$'],
|
| 7 |
+
importOrderSeparation: true,
|
| 8 |
+
importOrderSortSpecifiers: true,
|
| 9 |
+
plugins: [
|
| 10 |
+
require.resolve('@trivago/prettier-plugin-sort-imports'),
|
| 11 |
+
require('prettier-plugin-tailwindcss'),
|
| 12 |
+
],
|
| 13 |
+
};
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.storybook/main.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { StorybookConfig } from '@storybook/nextjs';
|
| 2 |
+
import path from 'path';
|
| 3 |
+
|
| 4 |
+
const config: StorybookConfig = {
|
| 5 |
+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
|
| 6 |
+
features: {
|
| 7 |
+
experimentalRSC: true,
|
| 8 |
+
},
|
| 9 |
+
addons: [
|
| 10 |
+
'@storybook/addon-links',
|
| 11 |
+
'@storybook/addon-essentials',
|
| 12 |
+
'@chromatic-com/storybook',
|
| 13 |
+
'@storybook/addon-interactions',
|
| 14 |
+
],
|
| 15 |
+
framework: {
|
| 16 |
+
name: '@storybook/nextjs',
|
| 17 |
+
options: {},
|
| 18 |
+
},
|
| 19 |
+
staticDirs: ['../public'],
|
| 20 |
+
webpackFinal: async (config) => {
|
| 21 |
+
if (config.resolve) {
|
| 22 |
+
config.resolve.alias = {
|
| 23 |
+
...config.resolve.alias,
|
| 24 |
+
'@': path.resolve(__dirname, '../src'),
|
| 25 |
+
};
|
| 26 |
+
}
|
| 27 |
+
return config;
|
| 28 |
+
},
|
| 29 |
+
};
|
| 30 |
+
export default config;
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/.storybook/preview.tsx
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { Preview } from '@storybook/react';
|
| 2 |
+
import { ThemeProvider } from 'next-themes';
|
| 3 |
+
import React from 'react';
|
| 4 |
+
|
| 5 |
+
import '@/styles/main.css';
|
| 6 |
+
|
| 7 |
+
const preview: Preview = {
|
| 8 |
+
decorators: [
|
| 9 |
+
(Story) => (
|
| 10 |
+
<div className="grid h-screen w-screen grid-cols-2">
|
| 11 |
+
<main className="dark bg-volcanic-100 p-3">
|
| 12 |
+
<Story />
|
| 13 |
+
</main>
|
| 14 |
+
<main className="bg-marble-950 p-3">
|
| 15 |
+
<Story />
|
| 16 |
+
</main>
|
| 17 |
+
</div>
|
| 18 |
+
),
|
| 19 |
+
],
|
| 20 |
+
parameters: {
|
| 21 |
+
nextjs: {
|
| 22 |
+
appDirectory: true,
|
| 23 |
+
router: {
|
| 24 |
+
basePath: '/',
|
| 25 |
+
},
|
| 26 |
+
},
|
| 27 |
+
controls: {
|
| 28 |
+
matchers: {
|
| 29 |
+
color: /(background|color)$/i,
|
| 30 |
+
date: /Date$/i,
|
| 31 |
+
},
|
| 32 |
+
},
|
| 33 |
+
layout: 'fullscreen',
|
| 34 |
+
},
|
| 35 |
+
};
|
| 36 |
+
|
| 37 |
+
export default preview;
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/Dockerfile
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM node:20-alpine AS base
|
| 2 |
+
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
|
| 5 |
+
# Install dependencies based on the preferred package manager
|
| 6 |
+
COPY package.json package-lock.json ./
|
| 7 |
+
COPY patches ./patches
|
| 8 |
+
RUN npm ci
|
| 9 |
+
|
| 10 |
+
COPY src ./src
|
| 11 |
+
COPY public ./public
|
| 12 |
+
COPY next.config.mjs .
|
| 13 |
+
COPY tsconfig.json .
|
| 14 |
+
COPY tailwind.config.js .
|
| 15 |
+
COPY postcss.config.js .
|
| 16 |
+
COPY .en[v] .env
|
| 17 |
+
|
| 18 |
+
# Next.js collects completely anonymous telemetry data about general usage. Learn more here: https://nextjs.org/telemetry
|
| 19 |
+
# Uncomment the following line to disable telemetry at run time
|
| 20 |
+
# ENV NEXT_TELEMETRY_DISABLED 1
|
| 21 |
+
|
| 22 |
+
# Note: Don't expose ports here, Compose will handle that for us
|
| 23 |
+
|
| 24 |
+
# Start Next.js in development mode based on the preferred package manager
|
| 25 |
+
FROM base as dev
|
| 26 |
+
CMD npm run dev
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
# Production specifc tareget
|
| 30 |
+
FROM base AS prod
|
| 31 |
+
RUN npm run build
|
| 32 |
+
CMD npm run start
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Assistants Chat Interface
|
| 2 |
+
|
| 3 |
+
Cohere's open source web interface for users to have helpful conversations with our conversational models.
|
| 4 |
+
|
| 5 |
+
> [!CAUTION]
|
| 6 |
+
> This is a work in progress interface that will replace coral_web, for now refer to (coral_web)[../coral_web/README.md].
|
| 7 |
+
|
| 8 |
+
## Usage
|
| 9 |
+
|
| 10 |
+
```shell
|
| 11 |
+
# start in development mode
|
| 12 |
+
npm dev
|
| 13 |
+
|
| 14 |
+
# build for production
|
| 15 |
+
npm build
|
| 16 |
+
|
| 17 |
+
# start in production mode
|
| 18 |
+
npm start
|
| 19 |
+
|
| 20 |
+
# lint
|
| 21 |
+
npm lint
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
## Environment Variables
|
| 25 |
+
|
| 26 |
+
We define environment-specific variables in the `.env.<<ENVIRONMENT>>` files and our current supported environments are: `production`, `stg`/`staging`, `ci`, and `development`. The following are our supported variables:
|
| 27 |
+
|
| 28 |
+
| Variable | Description |
|
| 29 |
+
| ----------------------------- | ----------------------------------------------------------- |
|
| 30 |
+
| NEXT_PUBLIC_API_HOSTNAME | API hostname that indicates the backend environment to hit. |
|
| 31 |
+
| NEXT_PUBLIC_FRONTEND_HOSTNAME | The host for the web interface. |
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/next-env.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/// <reference types="next" />
|
| 2 |
+
/// <reference types="next/image-types/global" />
|
| 3 |
+
|
| 4 |
+
// NOTE: This file should not be edited
|
| 5 |
+
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/next.config.mjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Next.js config utils
|
| 3 |
+
*/
|
| 4 |
+
import pickBy from 'lodash/pickBy.js';
|
| 5 |
+
import { PHASE_PRODUCTION_BUILD, PHASE_PRODUCTION_SERVER } from 'next/constants.js';
|
| 6 |
+
|
| 7 |
+
import { env } from './src/env.mjs';
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* Get common environment variables used by a Next.js app.
|
| 11 |
+
*
|
| 12 |
+
* @param {Record<string, string>} env - Environment variables, typically `process.env`.
|
| 13 |
+
*/
|
| 14 |
+
export const getCommonEnvVars = (env) => {
|
| 15 |
+
return {
|
| 16 |
+
...pickBy(env, (_value, key) => key.startsWith('NEXT_')),
|
| 17 |
+
};
|
| 18 |
+
};
|
| 19 |
+
|
| 20 |
+
/** @type {import('next').NextConfig} */
|
| 21 |
+
const nextConfig = {
|
| 22 |
+
reactStrictMode: true,
|
| 23 |
+
images: {
|
| 24 |
+
remotePatterns: [
|
| 25 |
+
// Favicons for RAG citations documents
|
| 26 |
+
{
|
| 27 |
+
protocol: 'https',
|
| 28 |
+
hostname: 'www.google.com',
|
| 29 |
+
port: '',
|
| 30 |
+
pathname: '/**',
|
| 31 |
+
},
|
| 32 |
+
],
|
| 33 |
+
},
|
| 34 |
+
};
|
| 35 |
+
|
| 36 |
+
const getNextConfig = (phase) => {
|
| 37 |
+
if (phase === PHASE_PRODUCTION_BUILD || phase === PHASE_PRODUCTION_SERVER) {
|
| 38 |
+
console.info('Next.js environment variables:', getCommonEnvVars(env));
|
| 39 |
+
}
|
| 40 |
+
return nextConfig;
|
| 41 |
+
};
|
| 42 |
+
|
| 43 |
+
export default getNextConfig;
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/openapi-ts.config.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { defineConfig } from '@hey-api/openapi-ts';
|
| 2 |
+
|
| 3 |
+
export default defineConfig({
|
| 4 |
+
input: 'http://0.0.0.0:8000/openapi.json',
|
| 5 |
+
output: './src/cohere-client/generated',
|
| 6 |
+
name: 'CohereClientGenerated',
|
| 7 |
+
types: {
|
| 8 |
+
enums: 'typescript',
|
| 9 |
+
},
|
| 10 |
+
services: {
|
| 11 |
+
asClass: true,
|
| 12 |
+
},
|
| 13 |
+
});
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/package-lock.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/package.json
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@cohere-ai/assistants-frontend",
|
| 3 |
+
"version": "0.0.0",
|
| 4 |
+
"private": true,
|
| 5 |
+
"engines": {
|
| 6 |
+
"npm": ">=9",
|
| 7 |
+
"node": ">=20.12.2",
|
| 8 |
+
"pnpm": "9999",
|
| 9 |
+
"yarn": "9999"
|
| 10 |
+
},
|
| 11 |
+
"scripts": {
|
| 12 |
+
"dev": "next dev --port 4000",
|
| 13 |
+
"build": "next build",
|
| 14 |
+
"lint": "next lint",
|
| 15 |
+
"ts-lint": "tsc -noEmit -incremental -watch",
|
| 16 |
+
"format": "prettier --check \"**/*.{js,json,ts,tsx,md}\"",
|
| 17 |
+
"format:write": "prettier --write \"**/*.{js,json,ts,tsx,md}\"",
|
| 18 |
+
"test": "vitest",
|
| 19 |
+
"next:build": "next build",
|
| 20 |
+
"start": "next start --port 4000",
|
| 21 |
+
"start:single-docker": "next start --port 4000",
|
| 22 |
+
"start:single-docker-proxy": "next start --port 8090",
|
| 23 |
+
"generate:client": "openapi-ts",
|
| 24 |
+
"storybook": "storybook dev -p 6006",
|
| 25 |
+
"build-storybook": "storybook build",
|
| 26 |
+
"postinstall": "patch-package"
|
| 27 |
+
},
|
| 28 |
+
"dependencies": {
|
| 29 |
+
"@floating-ui/react": "^0.26.9",
|
| 30 |
+
"@headlessui/react": "^2.1.2",
|
| 31 |
+
"@microsoft/fetch-event-source": "^2.0.1",
|
| 32 |
+
"@popperjs/core": "^2.11.8",
|
| 33 |
+
"@react-hookz/web": "^23.1.0",
|
| 34 |
+
"@t3-oss/env-nextjs": "^0.7.1",
|
| 35 |
+
"@tanstack/react-query": "^5.8.9",
|
| 36 |
+
"@tanstack/react-query-devtools": "^5.8.9",
|
| 37 |
+
"@types/babel__core": "^7.1.19",
|
| 38 |
+
"@types/dom-view-transitions": "^1.0.5",
|
| 39 |
+
"@types/google.picker": "^0.0.42",
|
| 40 |
+
"@types/is": "^0.0.21",
|
| 41 |
+
"@types/mdast": "^4.0.3",
|
| 42 |
+
"@types/react": "^18.2.18",
|
| 43 |
+
"autoprefixer": "^10.4.7",
|
| 44 |
+
"axios": "^1.7.4",
|
| 45 |
+
"classnames": "^2.5.1",
|
| 46 |
+
"cross-fetch": "^3.1.8",
|
| 47 |
+
"csstype": "^3.0.10",
|
| 48 |
+
"form-data": "^4.0.0",
|
| 49 |
+
"hast-util-to-jsx-runtime": "^2.3.0",
|
| 50 |
+
"js-cookie": "^3.0.5",
|
| 51 |
+
"jwt-decode": "^4.0.0",
|
| 52 |
+
"lodash": "^4.17.21",
|
| 53 |
+
"match-sorter": "^6.3.1",
|
| 54 |
+
"mdast-util-to-string": "^4.0.0",
|
| 55 |
+
"nanoid": "^3.3.8",
|
| 56 |
+
"next": "^14.2.12",
|
| 57 |
+
"next-client-cookies": "^1.1.1",
|
| 58 |
+
"next-runtime-env": "^3.2.2",
|
| 59 |
+
"next-themes": "^0.3.0",
|
| 60 |
+
"node-html-parser": "^6.1.4",
|
| 61 |
+
"parse-domain": "^8.0.1",
|
| 62 |
+
"postcss": "^8.4.39",
|
| 63 |
+
"postcss-viewport-height-correction": "^1.1.1",
|
| 64 |
+
"react": "^18.2.0",
|
| 65 |
+
"react-aria": "^3.24.0",
|
| 66 |
+
"react-dom": "^18.2.0",
|
| 67 |
+
"react-flip-toolkit": "^7.1.0",
|
| 68 |
+
"react-google-drive-picker": "^1.2.2",
|
| 69 |
+
"react-hook-form": "^7.52.1",
|
| 70 |
+
"react-hotkeys-hook": "^4.5.0",
|
| 71 |
+
"react-lottie-player": "^1.4.3",
|
| 72 |
+
"react-markdown": "^9.0.1",
|
| 73 |
+
"react-popper": "^2.3.0",
|
| 74 |
+
"react-scroll-to-bottom": "^4.2.0",
|
| 75 |
+
"react-swipeable": "^7.0.1",
|
| 76 |
+
"react-syntax-highlighter": "^15.5.0",
|
| 77 |
+
"rehype-highlight": "6.0.0",
|
| 78 |
+
"rehype-katex": "^7.0.0",
|
| 79 |
+
"rehype-raw": "^7.0.0",
|
| 80 |
+
"remark": "^15.0.1",
|
| 81 |
+
"remark-directive": "^3.0.0",
|
| 82 |
+
"remark-gfm": "^4.0.0",
|
| 83 |
+
"remark-math": "^6.0.0",
|
| 84 |
+
"sonner": "^1.4.0",
|
| 85 |
+
"tailwind-merge": "^2.5.2",
|
| 86 |
+
"tailwindcss": "^3.1.6",
|
| 87 |
+
"typescript": "^5.4.0",
|
| 88 |
+
"unified": "^11.0.4",
|
| 89 |
+
"unist-util-visit": "^5.0.0",
|
| 90 |
+
"zod": "^3.22.4",
|
| 91 |
+
"zustand": "4.3.1"
|
| 92 |
+
},
|
| 93 |
+
"devDependencies": {
|
| 94 |
+
"@chromatic-com/storybook": "^1.6.1",
|
| 95 |
+
"@hey-api/openapi-ts": "^0.48.1",
|
| 96 |
+
"@storybook/addon-essentials": "^8.2.6",
|
| 97 |
+
"@storybook/addon-interactions": "^8.2.6",
|
| 98 |
+
"@storybook/addon-links": "^8.2.6",
|
| 99 |
+
"@storybook/addon-onboarding": "^8.2.6",
|
| 100 |
+
"@storybook/blocks": "^8.2.6",
|
| 101 |
+
"@storybook/nextjs": "^8.2.6",
|
| 102 |
+
"@storybook/react": "^8.2.6",
|
| 103 |
+
"@storybook/test": "^8.2.6",
|
| 104 |
+
"@tailwindcss/typography": "^0.5.9",
|
| 105 |
+
"@testing-library/dom": "^10.4.0",
|
| 106 |
+
"@testing-library/react": "^16.0.0",
|
| 107 |
+
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
|
| 108 |
+
"@types/js-cookie": "^3.0.6",
|
| 109 |
+
"@types/lodash": "^4.14.185",
|
| 110 |
+
"@types/node": "^18.15.0",
|
| 111 |
+
"@types/react-scroll-to-bottom": "^4.2.0",
|
| 112 |
+
"@types/react-syntax-highlighter": "^15.5.11",
|
| 113 |
+
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
| 114 |
+
"@typescript-eslint/parser": "^6.7.4",
|
| 115 |
+
"@vitejs/plugin-react": "^4.3.1",
|
| 116 |
+
"eslint": "^8.50.0",
|
| 117 |
+
"eslint-config-next": "^13.5.4",
|
| 118 |
+
"eslint-config-prettier": "^9.0.0",
|
| 119 |
+
"eslint-plugin-storybook": "^0.8.0",
|
| 120 |
+
"jsdom": "^24.1.1",
|
| 121 |
+
"patch-package": "^8.0.0",
|
| 122 |
+
"postcss-100vh-fix": "^1.0.2",
|
| 123 |
+
"prettier": "2.8.7",
|
| 124 |
+
"prettier-plugin-tailwindcss": "0.4.1",
|
| 125 |
+
"storybook": "^8.2.6",
|
| 126 |
+
"vitest": "^2.1.9"
|
| 127 |
+
}
|
| 128 |
+
}
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/patches/react-scroll-to-bottom+4.2.0.patch
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/node_modules/react-scroll-to-bottom/lib/BasicScrollToBottom.js b/node_modules/react-scroll-to-bottom/lib/BasicScrollToBottom.js
|
| 2 |
+
index a2ce383..0c4d0fd 100644
|
| 3 |
+
--- a/node_modules/react-scroll-to-bottom/lib/BasicScrollToBottom.js
|
| 4 |
+
+++ b/node_modules/react-scroll-to-bottom/lib/BasicScrollToBottom.js
|
| 5 |
+
@@ -43,12 +43,6 @@ var BasicScrollToBottomCore = function BasicScrollToBottomCore(_ref) {
|
| 6 |
+
}));
|
| 7 |
+
};
|
| 8 |
+
|
| 9 |
+
-BasicScrollToBottomCore.defaultProps = {
|
| 10 |
+
- children: undefined,
|
| 11 |
+
- className: undefined,
|
| 12 |
+
- followButtonClassName: undefined,
|
| 13 |
+
- scrollViewClassName: undefined
|
| 14 |
+
-};
|
| 15 |
+
BasicScrollToBottomCore.propTypes = {
|
| 16 |
+
children: _propTypes["default"].any,
|
| 17 |
+
className: _propTypes["default"].string,
|
| 18 |
+
@@ -63,7 +57,7 @@ var BasicScrollToBottom = function BasicScrollToBottom(_ref2) {
|
| 19 |
+
debounce = _ref2.debounce,
|
| 20 |
+
debug = _ref2.debug,
|
| 21 |
+
followButtonClassName = _ref2.followButtonClassName,
|
| 22 |
+
- initialScrollBehavior = _ref2.initialScrollBehavior,
|
| 23 |
+
+ initialScrollBehavior = _ref2.initialScrollBehavior || 'smooth',
|
| 24 |
+
mode = _ref2.mode,
|
| 25 |
+
nonce = _ref2.nonce,
|
| 26 |
+
scroller = _ref2.scroller,
|
| 27 |
+
@@ -83,19 +77,6 @@ var BasicScrollToBottom = function BasicScrollToBottom(_ref2) {
|
| 28 |
+
}, children));
|
| 29 |
+
};
|
| 30 |
+
|
| 31 |
+
-BasicScrollToBottom.defaultProps = {
|
| 32 |
+
- checkInterval: undefined,
|
| 33 |
+
- children: undefined,
|
| 34 |
+
- className: undefined,
|
| 35 |
+
- debounce: undefined,
|
| 36 |
+
- debug: undefined,
|
| 37 |
+
- followButtonClassName: undefined,
|
| 38 |
+
- initialScrollBehavior: 'smooth',
|
| 39 |
+
- mode: undefined,
|
| 40 |
+
- nonce: undefined,
|
| 41 |
+
- scroller: undefined,
|
| 42 |
+
- scrollViewClassName: undefined
|
| 43 |
+
-};
|
| 44 |
+
BasicScrollToBottom.propTypes = {
|
| 45 |
+
checkInterval: _propTypes["default"].number,
|
| 46 |
+
children: _propTypes["default"].any,
|
| 47 |
+
diff --git a/node_modules/react-scroll-to-bottom/lib/EventSpy.js b/node_modules/react-scroll-to-bottom/lib/EventSpy.js
|
| 48 |
+
index 61ad8cb..a780148 100644
|
| 49 |
+
--- a/node_modules/react-scroll-to-bottom/lib/EventSpy.js
|
| 50 |
+
+++ b/node_modules/react-scroll-to-bottom/lib/EventSpy.js
|
| 51 |
+
@@ -19,7 +19,7 @@ var _react = require("react");
|
| 52 |
+
var _debounce = _interopRequireDefault(require("./debounce"));
|
| 53 |
+
|
| 54 |
+
var EventSpy = function EventSpy(_ref) {
|
| 55 |
+
- var debounce = _ref.debounce,
|
| 56 |
+
+ var debounce = _ref.debounce || 200,
|
| 57 |
+
name = _ref.name,
|
| 58 |
+
onEvent = _ref.onEvent,
|
| 59 |
+
target = _ref.target;
|
| 60 |
+
@@ -52,9 +52,6 @@ var EventSpy = function EventSpy(_ref) {
|
| 61 |
+
return false;
|
| 62 |
+
};
|
| 63 |
+
|
| 64 |
+
-EventSpy.defaultProps = {
|
| 65 |
+
- debounce: 200
|
| 66 |
+
-};
|
| 67 |
+
var _default = EventSpy;
|
| 68 |
+
exports["default"] = _default;
|
| 69 |
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9FdmVudFNweS5qcyJdLCJuYW1lcyI6WyJFdmVudFNweSIsImRlYm91bmNlIiwibmFtZSIsIm9uRXZlbnQiLCJ0YXJnZXQiLCJvbkV2ZW50UmVmIiwiY3VycmVudCIsImRlYm91bmNlciIsImV2ZW50IiwiaGFuZGxlRXZlbnQiLCJ0aW1lU3RhbXBMb3ciLCJhZGRFdmVudExpc3RlbmVyIiwicGFzc2l2ZSIsInR5cGUiLCJyZW1vdmVFdmVudExpc3RlbmVyIiwiZGVmYXVsdFByb3BzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7O0FBQUE7O0FBRUE7O0FBRUEsSUFBTUEsUUFBUSxHQUFHLFNBQVhBLFFBQVcsT0FBeUM7QUFBQSxNQUF0Q0MsUUFBc0MsUUFBdENBLFFBQXNDO0FBQUEsTUFBNUJDLElBQTRCLFFBQTVCQSxJQUE0QjtBQUFBLE1BQXRCQyxPQUFzQixRQUF0QkEsT0FBc0I7QUFBQSxNQUFiQyxNQUFhLFFBQWJBLE1BQWE7QUFDeEQ7QUFDQTtBQUNBLE1BQU1DLFVBQVUsR0FBRyxvQkFBbkI7QUFFQUEsRUFBQUEsVUFBVSxDQUFDQyxPQUFYLEdBQXFCSCxPQUFyQjtBQUVBLE1BQU1JLFNBQVMsR0FBRyxvQkFDaEI7QUFBQSxXQUNFLDBCQUFXLFVBQUFDLEtBQUssRUFBSTtBQUNsQixVQUFRRixPQUFSLEdBQW9CRCxVQUFwQixDQUFRQyxPQUFSO0FBRUFBLE1BQUFBLE9BQU8sSUFBSUEsT0FBTyxDQUFDRSxLQUFELENBQWxCO0FBQ0QsS0FKRCxFQUlHUCxRQUpILENBREY7QUFBQSxHQURnQixFQU9oQixDQUFDQSxRQUFELEVBQVdJLFVBQVgsQ0FQZ0IsQ0FBbEI7QUFVQSxNQUFNSSxXQUFXLEdBQUcsd0JBQ2xCLFVBQUFELEtBQUssRUFBSTtBQUNQQSxJQUFBQSxLQUFLLENBQUNFLFlBQU4sR0FBcUIsc0JBQXJCO0FBRUFILElBQUFBLFNBQVMsQ0FBQ0MsS0FBRCxDQUFUO0FBQ0QsR0FMaUIsRUFNbEIsQ0FBQ0QsU0FBRCxDQU5rQixDQUFwQjtBQVNBLDhCQUFnQixZQUFNO0FBQ3BCSCxJQUFBQSxNQUFNLENBQUNPLGdCQUFQLENBQXdCVCxJQUF4QixFQUE4Qk8sV0FBOUIsRUFBMkM7QUFBRUcsTUFBQUEsT0FBTyxFQUFFO0FBQVgsS0FBM0M7QUFDQUgsSUFBQUEsV0FBVyxDQUFDO0FBQUVMLE1BQUFBLE1BQU0sRUFBTkEsTUFBRjtBQUFVUyxNQUFBQSxJQUFJLEVBQUVYO0FBQWhCLEtBQUQsQ0FBWDtBQUVBLFdBQU87QUFBQSxhQUFNRSxNQUFNLENBQUNVLG1CQUFQLENBQTJCWixJQUEzQixFQUFpQ08sV0FBakMsQ0FBTjtBQUFBLEtBQVA7QUFDRCxHQUxELEVBS0csQ0FBQ1AsSUFBRCxFQUFPTyxXQUFQLEVBQW9CTCxNQUFwQixDQUxIO0FBT0EsU0FBTyxLQUFQO0FBQ0QsQ0FsQ0Q7O0FBb0NBSixRQUFRLENBQUNlLFlBQVQsR0FBd0I7QUFDdEJkLEVBQUFBLFFBQVEsRUFBRTtBQURZLENBQXhCO2VBSWVELFEiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyB1c2VDYWxsYmFjaywgdXNlTGF5b3V0RWZmZWN0LCB1c2VNZW1vLCB1c2VSZWYgfSBmcm9tICdyZWFjdCc7XG5cbmltcG9ydCBkZWJvdW5jZUZuIGZyb20gJy4vZGVib3VuY2UnO1xuXG5jb25zdCBFdmVudFNweSA9ICh7IGRlYm91bmNlLCBuYW1lLCBvbkV2ZW50LCB0YXJnZXQgfSkgPT4ge1xuICAvLyBXZSBuZWVkIHRvIHNhdmUgdGhlIFwib25FdmVudFwiIHRvIHJlZi5cbiAgLy8gVGhpcyBpcyBiZWNhdXNlIFwib25FdmVudFwiIG1heSBjaGFuZ2UgZnJvbSB0aW1lIHRvIHRpbWUsIGJ1dCBkZWJvdW5jZSBtYXkgc3RpbGwgZmlyZSB0byB0aGUgb2xkZXIgY2FsbGJhY2suXG4gIGNvbnN0IG9uRXZlbnRSZWYgPSB1c2VSZWYoKTtcblxuICBvbkV2ZW50UmVmLmN1cnJlbnQgPSBvbkV2ZW50O1xuXG4gIGNvbnN0IGRlYm91bmNlciA9IHVzZU1lbW8oXG4gICAgKCkgPT5cbiAgICAgIGRlYm91bmNlRm4oZXZlbnQgPT4ge1xuICAgICAgICBjb25zdCB7IGN1cnJlbnQgfSA9IG9uRXZlbnRSZWY7XG5cbiAgICAgICAgY3VycmVudCAmJiBjdXJyZW50KGV2ZW50KTtcbiAgICAgIH0sIGRlYm91bmNlKSxcbiAgICBbZGVib3VuY2UsIG9uRXZlbnRSZWZdXG4gICk7XG5cbiAgY29uc3QgaGFuZGxlRXZlbnQgPSB1c2VDYWxsYmFjayhcbiAgICBldmVudCA9PiB7XG4gICAgICBldmVudC50aW1lU3RhbXBMb3cgPSBEYXRlLm5vdygpO1xuXG4gICAgICBkZWJvdW5jZXIoZXZlbnQpO1xuICAgIH0sXG4gICAgW2RlYm91bmNlcl1cbiAgKTtcblxuICB1c2VMYXlvdXRFZmZlY3QoKCkgPT4ge1xuICAgIHRhcmdldC5hZGRFdmVudExpc3RlbmVyKG5hbWUsIGhhbmRsZUV2ZW50LCB7IHBhc3NpdmU6IHRydWUgfSk7XG4gICAgaGFuZGxlRXZlbnQoeyB0YXJnZXQsIHR5cGU6IG5hbWUgfSk7XG5cbiAgICByZXR1cm4gKCkgPT4gdGFyZ2V0LnJlbW92ZUV2ZW50TGlzdGVuZXIobmFtZSwgaGFuZGxlRXZlbnQpO1xuICB9LCBbbmFtZSwgaGFuZGxlRXZlbnQsIHRhcmdldF0pO1xuXG4gIHJldHVybiBmYWxzZTtcbn07XG5cbkV2ZW50U3B5LmRlZmF1bHRQcm9wcyA9IHtcbiAgZGVib3VuY2U6IDIwMFxufTtcblxuZXhwb3J0IGRlZmF1bHQgRXZlbnRTcHk7XG4iXX0=
|
| 70 |
+
diff --git a/node_modules/react-scroll-to-bottom/lib/ScrollToBottom/AutoHideFollowButton.js b/node_modules/react-scroll-to-bottom/lib/ScrollToBottom/AutoHideFollowButton.js
|
| 71 |
+
index 79c5ade..7e1c3aa 100644
|
| 72 |
+
--- a/node_modules/react-scroll-to-bottom/lib/ScrollToBottom/AutoHideFollowButton.js
|
| 73 |
+
+++ b/node_modules/react-scroll-to-bottom/lib/ScrollToBottom/AutoHideFollowButton.js
|
| 74 |
+
@@ -45,7 +45,7 @@ var ROOT_STYLE = {
|
| 75 |
+
|
| 76 |
+
var AutoHideFollowButton = function AutoHideFollowButton(_ref) {
|
| 77 |
+
var children = _ref.children,
|
| 78 |
+
- className = _ref.className;
|
| 79 |
+
+ className = _ref.className || '';
|
| 80 |
+
|
| 81 |
+
var _useSticky = (0, _useSticky3["default"])(),
|
| 82 |
+
_useSticky2 = (0, _slicedToArray2["default"])(_useSticky, 1),
|
| 83 |
+
@@ -60,10 +60,6 @@ var AutoHideFollowButton = function AutoHideFollowButton(_ref) {
|
| 84 |
+
}, children);
|
| 85 |
+
};
|
| 86 |
+
|
| 87 |
+
-AutoHideFollowButton.defaultProps = {
|
| 88 |
+
- children: undefined,
|
| 89 |
+
- className: ''
|
| 90 |
+
-};
|
| 91 |
+
AutoHideFollowButton.propTypes = {
|
| 92 |
+
children: _propTypes["default"].any,
|
| 93 |
+
className: _propTypes["default"].string
|
| 94 |
+
diff --git a/node_modules/react-scroll-to-bottom/lib/ScrollToBottom/Composer.js b/node_modules/react-scroll-to-bottom/lib/ScrollToBottom/Composer.js
|
| 95 |
+
index 1d5f8b1..130643e 100644
|
| 96 |
+
--- a/node_modules/react-scroll-to-bottom/lib/ScrollToBottom/Composer.js
|
| 97 |
+
+++ b/node_modules/react-scroll-to-bottom/lib/ScrollToBottom/Composer.js
|
| 98 |
+
@@ -129,14 +129,14 @@ function isEnd(animateTo, mode) {
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
var Composer = function Composer(_ref2) {
|
| 102 |
+
- var checkInterval = _ref2.checkInterval,
|
| 103 |
+
+ var checkInterval = _ref2.checkInterval || 100,
|
| 104 |
+
children = _ref2.children,
|
| 105 |
+
- debounce = _ref2.debounce,
|
| 106 |
+
+ debounce = _ref2.debounce || 17,
|
| 107 |
+
debugFromProp = _ref2.debug,
|
| 108 |
+
- initialScrollBehavior = _ref2.initialScrollBehavior,
|
| 109 |
+
+ initialScrollBehavior = _ref2.initialScrollBehavior || 'smooth',
|
| 110 |
+
mode = _ref2.mode,
|
| 111 |
+
nonce = _ref2.nonce,
|
| 112 |
+
- scroller = _ref2.scroller;
|
| 113 |
+
+ scroller = _ref2.scroller || DEFAULT_SCROLLER;
|
| 114 |
+
var debug = (0, _react.useMemo)(function () {
|
| 115 |
+
return (0, _debug["default"])("<ScrollToBottom>", {
|
| 116 |
+
force: debugFromProp
|
| 117 |
+
@@ -660,16 +660,6 @@ var Composer = function Composer(_ref2) {
|
| 118 |
+
}))))));
|
| 119 |
+
};
|
| 120 |
+
|
| 121 |
+
-Composer.defaultProps = {
|
| 122 |
+
- checkInterval: 100,
|
| 123 |
+
- children: undefined,
|
| 124 |
+
- debounce: 17,
|
| 125 |
+
- debug: undefined,
|
| 126 |
+
- initialScrollBehavior: 'smooth',
|
| 127 |
+
- mode: undefined,
|
| 128 |
+
- nonce: undefined,
|
| 129 |
+
- scroller: DEFAULT_SCROLLER
|
| 130 |
+
-};
|
| 131 |
+
Composer.propTypes = {
|
| 132 |
+
checkInterval: _propTypes["default"].number,
|
| 133 |
+
children: _propTypes["default"].any,
|
| 134 |
+
diff --git a/node_modules/react-scroll-to-bottom/lib/ScrollToBottom/Panel.js b/node_modules/react-scroll-to-bottom/lib/ScrollToBottom/Panel.js
|
| 135 |
+
index 24f9403..f8047e3 100644
|
| 136 |
+
--- a/node_modules/react-scroll-to-bottom/lib/ScrollToBottom/Panel.js
|
| 137 |
+
+++ b/node_modules/react-scroll-to-bottom/lib/ScrollToBottom/Panel.js
|
| 138 |
+
@@ -50,10 +50,6 @@ var Panel = function Panel(_ref) {
|
| 139 |
+
}, children);
|
| 140 |
+
};
|
| 141 |
+
|
| 142 |
+
-Panel.defaultProps = {
|
| 143 |
+
- children: undefined,
|
| 144 |
+
- className: undefined
|
| 145 |
+
-};
|
| 146 |
+
Panel.propTypes = {
|
| 147 |
+
children: _propTypes["default"].any,
|
| 148 |
+
className: _propTypes["default"].string
|
| 149 |
+
diff --git a/node_modules/react-scroll-to-bottom/lib/esm/BasicScrollToBottom.js b/node_modules/react-scroll-to-bottom/lib/esm/BasicScrollToBottom.js
|
| 150 |
+
index 5b18efa..5f38d2f 100644
|
| 151 |
+
--- a/node_modules/react-scroll-to-bottom/lib/esm/BasicScrollToBottom.js
|
| 152 |
+
+++ b/node_modules/react-scroll-to-bottom/lib/esm/BasicScrollToBottom.js
|
| 153 |
+
@@ -24,12 +24,6 @@ var BasicScrollToBottomCore = function BasicScrollToBottomCore(_ref) {
|
| 154 |
+
}));
|
| 155 |
+
};
|
| 156 |
+
|
| 157 |
+
-BasicScrollToBottomCore.defaultProps = {
|
| 158 |
+
- children: undefined,
|
| 159 |
+
- className: undefined,
|
| 160 |
+
- followButtonClassName: undefined,
|
| 161 |
+
- scrollViewClassName: undefined
|
| 162 |
+
-};
|
| 163 |
+
BasicScrollToBottomCore.propTypes = {
|
| 164 |
+
children: PropTypes.any,
|
| 165 |
+
className: PropTypes.string,
|
| 166 |
+
@@ -44,7 +38,7 @@ var BasicScrollToBottom = function BasicScrollToBottom(_ref2) {
|
| 167 |
+
debounce = _ref2.debounce,
|
| 168 |
+
debug = _ref2.debug,
|
| 169 |
+
followButtonClassName = _ref2.followButtonClassName,
|
| 170 |
+
- initialScrollBehavior = _ref2.initialScrollBehavior,
|
| 171 |
+
+ initialScrollBehavior = _ref2.initialScrollBehavior || 'smooth',
|
| 172 |
+
mode = _ref2.mode,
|
| 173 |
+
nonce = _ref2.nonce,
|
| 174 |
+
scroller = _ref2.scroller,
|
| 175 |
+
@@ -64,19 +58,6 @@ var BasicScrollToBottom = function BasicScrollToBottom(_ref2) {
|
| 176 |
+
}, children));
|
| 177 |
+
};
|
| 178 |
+
|
| 179 |
+
-BasicScrollToBottom.defaultProps = {
|
| 180 |
+
- checkInterval: undefined,
|
| 181 |
+
- children: undefined,
|
| 182 |
+
- className: undefined,
|
| 183 |
+
- debounce: undefined,
|
| 184 |
+
- debug: undefined,
|
| 185 |
+
- followButtonClassName: undefined,
|
| 186 |
+
- initialScrollBehavior: 'smooth',
|
| 187 |
+
- mode: undefined,
|
| 188 |
+
- nonce: undefined,
|
| 189 |
+
- scroller: undefined,
|
| 190 |
+
- scrollViewClassName: undefined
|
| 191 |
+
-};
|
| 192 |
+
BasicScrollToBottom.propTypes = {
|
| 193 |
+
checkInterval: PropTypes.number,
|
| 194 |
+
children: PropTypes.any,
|
| 195 |
+
diff --git a/node_modules/react-scroll-to-bottom/lib/esm/EventSpy.js b/node_modules/react-scroll-to-bottom/lib/esm/EventSpy.js
|
| 196 |
+
index d0fd800..b5fd3cb 100644
|
| 197 |
+
--- a/node_modules/react-scroll-to-bottom/lib/esm/EventSpy.js
|
| 198 |
+
+++ b/node_modules/react-scroll-to-bottom/lib/esm/EventSpy.js
|
| 199 |
+
@@ -4,7 +4,7 @@ import { useCallback, useLayoutEffect, useMemo, useRef } from 'react';
|
| 200 |
+
import debounceFn from './debounce';
|
| 201 |
+
|
| 202 |
+
var EventSpy = function EventSpy(_ref) {
|
| 203 |
+
- var debounce = _ref.debounce,
|
| 204 |
+
+ var debounce = _ref.debounce || 200,
|
| 205 |
+
name = _ref.name,
|
| 206 |
+
onEvent = _ref.onEvent,
|
| 207 |
+
target = _ref.target;
|
| 208 |
+
@@ -37,8 +37,5 @@ var EventSpy = function EventSpy(_ref) {
|
| 209 |
+
return false;
|
| 210 |
+
};
|
| 211 |
+
|
| 212 |
+
-EventSpy.defaultProps = {
|
| 213 |
+
- debounce: 200
|
| 214 |
+
-};
|
| 215 |
+
export default EventSpy;
|
| 216 |
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9FdmVudFNweS5qcyJdLCJuYW1lcyI6WyJ1c2VDYWxsYmFjayIsInVzZUxheW91dEVmZmVjdCIsInVzZU1lbW8iLCJ1c2VSZWYiLCJkZWJvdW5jZUZuIiwiRXZlbnRTcHkiLCJkZWJvdW5jZSIsIm5hbWUiLCJvbkV2ZW50IiwidGFyZ2V0Iiwib25FdmVudFJlZiIsImN1cnJlbnQiLCJkZWJvdW5jZXIiLCJldmVudCIsImhhbmRsZUV2ZW50IiwidGltZVN0YW1wTG93IiwiYWRkRXZlbnRMaXN0ZW5lciIsInBhc3NpdmUiLCJ0eXBlIiwicmVtb3ZlRXZlbnRMaXN0ZW5lciIsImRlZmF1bHRQcm9wcyJdLCJtYXBwaW5ncyI6Ijs7QUFBQSxTQUFTQSxXQUFULEVBQXNCQyxlQUF0QixFQUF1Q0MsT0FBdkMsRUFBZ0RDLE1BQWhELFFBQThELE9BQTlEO0FBRUEsT0FBT0MsVUFBUCxNQUF1QixZQUF2Qjs7QUFFQSxJQUFNQyxRQUFRLEdBQUcsU0FBWEEsUUFBVyxPQUF5QztBQUFBLE1BQXRDQyxRQUFzQyxRQUF0Q0EsUUFBc0M7QUFBQSxNQUE1QkMsSUFBNEIsUUFBNUJBLElBQTRCO0FBQUEsTUFBdEJDLE9BQXNCLFFBQXRCQSxPQUFzQjtBQUFBLE1BQWJDLE1BQWEsUUFBYkEsTUFBYTtBQUN4RDtBQUNBO0FBQ0EsTUFBTUMsVUFBVSxHQUFHUCxNQUFNLEVBQXpCO0FBRUFPLEVBQUFBLFVBQVUsQ0FBQ0MsT0FBWCxHQUFxQkgsT0FBckI7QUFFQSxNQUFNSSxTQUFTLEdBQUdWLE9BQU8sQ0FDdkI7QUFBQSxXQUNFRSxVQUFVLENBQUMsVUFBQVMsS0FBSyxFQUFJO0FBQ2xCLFVBQVFGLE9BQVIsR0FBb0JELFVBQXBCLENBQVFDLE9BQVI7QUFFQUEsTUFBQUEsT0FBTyxJQUFJQSxPQUFPLENBQUNFLEtBQUQsQ0FBbEI7QUFDRCxLQUpTLEVBSVBQLFFBSk8sQ0FEWjtBQUFBLEdBRHVCLEVBT3ZCLENBQUNBLFFBQUQsRUFBV0ksVUFBWCxDQVB1QixDQUF6QjtBQVVBLE1BQU1JLFdBQVcsR0FBR2QsV0FBVyxDQUM3QixVQUFBYSxLQUFLLEVBQUk7QUFDUEEsSUFBQUEsS0FBSyxDQUFDRSxZQUFOLEdBQXFCLFdBQXJCO0FBRUFILElBQUFBLFNBQVMsQ0FBQ0MsS0FBRCxDQUFUO0FBQ0QsR0FMNEIsRUFNN0IsQ0FBQ0QsU0FBRCxDQU42QixDQUEvQjtBQVNBWCxFQUFBQSxlQUFlLENBQUMsWUFBTTtBQUNwQlEsSUFBQUEsTUFBTSxDQUFDTyxnQkFBUCxDQUF3QlQsSUFBeEIsRUFBOEJPLFdBQTlCLEVBQTJDO0FBQUVHLE1BQUFBLE9BQU8sRUFBRTtBQUFYLEtBQTNDO0FBQ0FILElBQUFBLFdBQVcsQ0FBQztBQUFFTCxNQUFBQSxNQUFNLEVBQU5BLE1BQUY7QUFBVVMsTUFBQUEsSUFBSSxFQUFFWDtBQUFoQixLQUFELENBQVg7QUFFQSxXQUFPO0FBQUEsYUFBTUUsTUFBTSxDQUFDVSxtQkFBUCxDQUEyQlosSUFBM0IsRUFBaUNPLFdBQWpDLENBQU47QUFBQSxLQUFQO0FBQ0QsR0FMYyxFQUtaLENBQUNQLElBQUQsRUFBT08sV0FBUCxFQUFvQkwsTUFBcEIsQ0FMWSxDQUFmO0FBT0EsU0FBTyxLQUFQO0FBQ0QsQ0FsQ0Q7O0FBb0NBSixRQUFRLENBQUNlLFlBQVQsR0FBd0I7QUFDdEJkLEVBQUFBLFFBQVEsRUFBRTtBQURZLENBQXhCO0FBSUEsZUFBZUQsUUFBZiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHVzZUNhbGxiYWNrLCB1c2VMYXlvdXRFZmZlY3QsIHVzZU1lbW8sIHVzZVJlZiB9IGZyb20gJ3JlYWN0JztcblxuaW1wb3J0IGRlYm91bmNlRm4gZnJvbSAnLi9kZWJvdW5jZSc7XG5cbmNvbnN0IEV2ZW50U3B5ID0gKHsgZGVib3VuY2UsIG5hbWUsIG9uRXZlbnQsIHRhcmdldCB9KSA9PiB7XG4gIC8vIFdlIG5lZWQgdG8gc2F2ZSB0aGUgXCJvbkV2ZW50XCIgdG8gcmVmLlxuICAvLyBUaGlzIGlzIGJlY2F1c2UgXCJvbkV2ZW50XCIgbWF5IGNoYW5nZSBmcm9tIHRpbWUgdG8gdGltZSwgYnV0IGRlYm91bmNlIG1heSBzdGlsbCBmaXJlIHRvIHRoZSBvbGRlciBjYWxsYmFjay5cbiAgY29uc3Qgb25FdmVudFJlZiA9IHVzZVJlZigpO1xuXG4gIG9uRXZlbnRSZWYuY3VycmVudCA9IG9uRXZlbnQ7XG5cbiAgY29uc3QgZGVib3VuY2VyID0gdXNlTWVtbyhcbiAgICAoKSA9PlxuICAgICAgZGVib3VuY2VGbihldmVudCA9PiB7XG4gICAgICAgIGNvbnN0IHsgY3VycmVudCB9ID0gb25FdmVudFJlZjtcblxuICAgICAgICBjdXJyZW50ICYmIGN1cnJlbnQoZXZlbnQpO1xuICAgICAgfSwgZGVib3VuY2UpLFxuICAgIFtkZWJvdW5jZSwgb25FdmVudFJlZl1cbiAgKTtcblxuICBjb25zdCBoYW5kbGVFdmVudCA9IHVzZUNhbGxiYWNrKFxuICAgIGV2ZW50ID0+IHtcbiAgICAgIGV2ZW50LnRpbWVTdGFtcExvdyA9IERhdGUubm93KCk7XG5cbiAgICAgIGRlYm91bmNlcihldmVudCk7XG4gICAgfSxcbiAgICBbZGVib3VuY2VyXVxuICApO1xuXG4gIHVzZUxheW91dEVmZmVjdCgoKSA9PiB7XG4gICAgdGFyZ2V0LmFkZEV2ZW50TGlzdGVuZXIobmFtZSwgaGFuZGxlRXZlbnQsIHsgcGFzc2l2ZTogdHJ1ZSB9KTtcbiAgICBoYW5kbGVFdmVudCh7IHRhcmdldCwgdHlwZTogbmFtZSB9KTtcblxuICAgIHJldHVybiAoKSA9PiB0YXJnZXQucmVtb3ZlRXZlbnRMaXN0ZW5lcihuYW1lLCBoYW5kbGVFdmVudCk7XG4gIH0sIFtuYW1lLCBoYW5kbGVFdmVudCwgdGFyZ2V0XSk7XG5cbiAgcmV0dXJuIGZhbHNlO1xufTtcblxuRXZlbnRTcHkuZGVmYXVsdFByb3BzID0ge1xuICBkZWJvdW5jZTogMjAwXG59O1xuXG5leHBvcnQgZGVmYXVsdCBFdmVudFNweTtcbiJdfQ==
|
| 217 |
+
diff --git a/node_modules/react-scroll-to-bottom/lib/esm/ScrollToBottom/AutoHideFollowButton.js b/node_modules/react-scroll-to-bottom/lib/esm/ScrollToBottom/AutoHideFollowButton.js
|
| 218 |
+
index eca67c2..8bdc2a5 100644
|
| 219 |
+
--- a/node_modules/react-scroll-to-bottom/lib/esm/ScrollToBottom/AutoHideFollowButton.js
|
| 220 |
+
+++ b/node_modules/react-scroll-to-bottom/lib/esm/ScrollToBottom/AutoHideFollowButton.js
|
| 221 |
+
@@ -26,7 +26,7 @@ var ROOT_STYLE = {
|
| 222 |
+
|
| 223 |
+
var AutoHideFollowButton = function AutoHideFollowButton(_ref) {
|
| 224 |
+
var children = _ref.children,
|
| 225 |
+
- className = _ref.className;
|
| 226 |
+
+ className = _ref.className || '';
|
| 227 |
+
|
| 228 |
+
var _useSticky = useSticky(),
|
| 229 |
+
_useSticky2 = _slicedToArray(_useSticky, 1),
|
| 230 |
+
@@ -41,10 +41,6 @@ var AutoHideFollowButton = function AutoHideFollowButton(_ref) {
|
| 231 |
+
}, children);
|
| 232 |
+
};
|
| 233 |
+
|
| 234 |
+
-AutoHideFollowButton.defaultProps = {
|
| 235 |
+
- children: undefined,
|
| 236 |
+
- className: ''
|
| 237 |
+
-};
|
| 238 |
+
AutoHideFollowButton.propTypes = {
|
| 239 |
+
children: PropTypes.any,
|
| 240 |
+
className: PropTypes.string
|
| 241 |
+
diff --git a/node_modules/react-scroll-to-bottom/lib/esm/ScrollToBottom/Composer.js b/node_modules/react-scroll-to-bottom/lib/esm/ScrollToBottom/Composer.js
|
| 242 |
+
index f5cec94..d063e1c 100644
|
| 243 |
+
--- a/node_modules/react-scroll-to-bottom/lib/esm/ScrollToBottom/Composer.js
|
| 244 |
+
+++ b/node_modules/react-scroll-to-bottom/lib/esm/ScrollToBottom/Composer.js
|
| 245 |
+
@@ -79,14 +79,14 @@ function isEnd(animateTo, mode) {
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
var Composer = function Composer(_ref2) {
|
| 249 |
+
- var checkInterval = _ref2.checkInterval,
|
| 250 |
+
+ var checkInterval = _ref2.checkInterval || 100,
|
| 251 |
+
children = _ref2.children,
|
| 252 |
+
- debounce = _ref2.debounce,
|
| 253 |
+
+ debounce = _ref2.debounce || 17,
|
| 254 |
+
debugFromProp = _ref2.debug,
|
| 255 |
+
- initialScrollBehavior = _ref2.initialScrollBehavior,
|
| 256 |
+
+ initialScrollBehavior = _ref2.initialScrollBehavior || 'smooth',
|
| 257 |
+
mode = _ref2.mode,
|
| 258 |
+
nonce = _ref2.nonce,
|
| 259 |
+
- scroller = _ref2.scroller;
|
| 260 |
+
+ scroller = _ref2.scroller || DEFAULT_SCROLLER;
|
| 261 |
+
var debug = useMemo(function () {
|
| 262 |
+
return createDebug("<ScrollToBottom>", {
|
| 263 |
+
force: debugFromProp
|
| 264 |
+
@@ -613,16 +613,6 @@ var Composer = function Composer(_ref2) {
|
| 265 |
+
}))))));
|
| 266 |
+
};
|
| 267 |
+
|
| 268 |
+
-Composer.defaultProps = {
|
| 269 |
+
- checkInterval: 100,
|
| 270 |
+
- children: undefined,
|
| 271 |
+
- debounce: 17,
|
| 272 |
+
- debug: undefined,
|
| 273 |
+
- initialScrollBehavior: 'smooth',
|
| 274 |
+
- mode: undefined,
|
| 275 |
+
- nonce: undefined,
|
| 276 |
+
- scroller: DEFAULT_SCROLLER
|
| 277 |
+
-};
|
| 278 |
+
Composer.propTypes = {
|
| 279 |
+
checkInterval: PropTypes.number,
|
| 280 |
+
children: PropTypes.any,
|
| 281 |
+
diff --git a/node_modules/react-scroll-to-bottom/lib/esm/ScrollToBottom/Panel.js b/node_modules/react-scroll-to-bottom/lib/esm/ScrollToBottom/Panel.js
|
| 282 |
+
index 02008df..5e5b11c 100644
|
| 283 |
+
--- a/node_modules/react-scroll-to-bottom/lib/esm/ScrollToBottom/Panel.js
|
| 284 |
+
+++ b/node_modules/react-scroll-to-bottom/lib/esm/ScrollToBottom/Panel.js
|
| 285 |
+
@@ -23,10 +23,6 @@ var Panel = function Panel(_ref) {
|
| 286 |
+
}, children);
|
| 287 |
+
};
|
| 288 |
+
|
| 289 |
+
-Panel.defaultProps = {
|
| 290 |
+
- children: undefined,
|
| 291 |
+
- className: undefined
|
| 292 |
+
-};
|
| 293 |
+
Panel.propTypes = {
|
| 294 |
+
children: PropTypes.any,
|
| 295 |
+
className: PropTypes.string
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/postcss.config.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module.exports = {
|
| 2 |
+
plugins: {
|
| 3 |
+
tailwindcss: {},
|
| 4 |
+
autoprefixer: {},
|
| 5 |
+
'postcss-100vh-fix': {}, // https://github.com/postcss/postcss-100vh-fix
|
| 6 |
+
'postcss-viewport-height-correction': {}, // https://github.com/Faisal-Manzer/postcss-viewport-height-correction
|
| 7 |
+
},
|
| 8 |
+
};
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/favicon.ico
ADDED
|
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/android-chrome-192x192.png
ADDED
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/android-chrome-512x512.png
ADDED
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/apple-touch-icon.png
ADDED
|
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/favicon-16x16.png
ADDED
|
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/favicon-32x32.png
ADDED
|
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/kycCellBackground.png
ADDED
|
Git LFS Details
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/mushroom-filled-icon-512x512.png
ADDED
|
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/share.png
ADDED
|
Git LFS Details
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/white-filled-icon-512x512.png
ADDED
|
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/site.webmanifest
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "Coral",
|
| 3 |
+
"description": "Cohere presents Coral, a knowledge assistant for enterprises to supercharge the productivity of their most strategic teams.",
|
| 4 |
+
"short_name": "Coral",
|
| 5 |
+
"start_url": "/",
|
| 6 |
+
"scope": "/",
|
| 7 |
+
"orientation": "portrait",
|
| 8 |
+
"launch_handler": {
|
| 9 |
+
"client_mode": "focus-existing"
|
| 10 |
+
},
|
| 11 |
+
"icons": [
|
| 12 |
+
{
|
| 13 |
+
"src": "/images/mushroom-filled-icon-512x512.png",
|
| 14 |
+
"sizes": "512x512",
|
| 15 |
+
"type": "image/png",
|
| 16 |
+
"purpose": "maskable"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"src": "/images/android-chrome-192x192.png",
|
| 20 |
+
"sizes": "192x192",
|
| 21 |
+
"type": "image/png"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"src": "/images/android-chrome-512x512.png",
|
| 25 |
+
"sizes": "512x512",
|
| 26 |
+
"type": "image/png"
|
| 27 |
+
}
|
| 28 |
+
],
|
| 29 |
+
"theme_color": "#e8e6de",
|
| 30 |
+
"background_color": "#e8e6de",
|
| 31 |
+
"display": "standalone"
|
| 32 |
+
}
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/videos/KYC_BG_5K.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:007f1328d587320ba7f22134db75b1a9a79d228787c2b47bb75180e272f9d4bc
|
| 3 |
+
size 8394172
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(auth)/auth/[strategy]/OauthCallback.tsx
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use client';
|
| 2 |
+
|
| 3 |
+
import { useParams, useRouter, useSearchParams } from 'next/navigation';
|
| 4 |
+
import { useEffect } from 'react';
|
| 5 |
+
|
| 6 |
+
import { Text } from '@/components/UI';
|
| 7 |
+
import { useAuthConfig, useNotify, useSession } from '@/hooks';
|
| 8 |
+
import { getQueryString } from '@/utils';
|
| 9 |
+
|
| 10 |
+
/**
|
| 11 |
+
* @description This page handles callbacks from OAuth providers and forwards the request to the backend.
|
| 12 |
+
*/
|
| 13 |
+
const OauthCallback: React.FC = () => {
|
| 14 |
+
const router = useRouter();
|
| 15 |
+
const params = useParams();
|
| 16 |
+
const search = useSearchParams();
|
| 17 |
+
|
| 18 |
+
const { oidcSSOMutation, googleSSOMutation } = useSession();
|
| 19 |
+
const redirect = getQueryString(search.get('redirect_uri'));
|
| 20 |
+
const code = getQueryString(search.get('code'));
|
| 21 |
+
const { loginStrategies: ssoLogins } = useAuthConfig();
|
| 22 |
+
const notify = useNotify();
|
| 23 |
+
|
| 24 |
+
const loginType = ssoLogins.find(
|
| 25 |
+
(login) => encodeURIComponent(login.strategy.toLowerCase()) == params.strategy
|
| 26 |
+
);
|
| 27 |
+
|
| 28 |
+
useEffect(() => {
|
| 29 |
+
if (!loginType || !code) {
|
| 30 |
+
return;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
if (loginType.strategy.toLowerCase() === 'google') {
|
| 34 |
+
googleSSOMutation.mutate(
|
| 35 |
+
{
|
| 36 |
+
code,
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
onSuccess: () => {
|
| 40 |
+
router.push(redirect || '/');
|
| 41 |
+
},
|
| 42 |
+
onError: () => {
|
| 43 |
+
notify.error('Failed to validate Google OAuth credentials');
|
| 44 |
+
router.push('/login');
|
| 45 |
+
},
|
| 46 |
+
}
|
| 47 |
+
);
|
| 48 |
+
return;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
oidcSSOMutation.mutate(
|
| 52 |
+
{
|
| 53 |
+
code,
|
| 54 |
+
strategy: loginType.strategy,
|
| 55 |
+
},
|
| 56 |
+
{
|
| 57 |
+
onSuccess: () => {
|
| 58 |
+
router.push(redirect || '/');
|
| 59 |
+
},
|
| 60 |
+
onError: () => {
|
| 61 |
+
notify.error('Failed to validate OAuth credentials');
|
| 62 |
+
router.push('/login');
|
| 63 |
+
},
|
| 64 |
+
}
|
| 65 |
+
);
|
| 66 |
+
}, [loginType]);
|
| 67 |
+
|
| 68 |
+
return (
|
| 69 |
+
<div className="flex flex-col items-center justify-center">
|
| 70 |
+
<Text as="h1" styleAs="h3">
|
| 71 |
+
Logging in
|
| 72 |
+
</Text>
|
| 73 |
+
</div>
|
| 74 |
+
);
|
| 75 |
+
};
|
| 76 |
+
|
| 77 |
+
export default OauthCallback;
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(auth)/auth/[strategy]/page.tsx
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { NextPage } from 'next';
|
| 2 |
+
import { Suspense } from 'react';
|
| 3 |
+
|
| 4 |
+
import OauthCallback from './OauthCallback';
|
| 5 |
+
|
| 6 |
+
const OauthCallbackPage: NextPage = () => {
|
| 7 |
+
return (
|
| 8 |
+
<Suspense>
|
| 9 |
+
<OauthCallback />
|
| 10 |
+
</Suspense>
|
| 11 |
+
);
|
| 12 |
+
};
|
| 13 |
+
|
| 14 |
+
export default OauthCallbackPage;
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(auth)/layout.tsx
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { WelcomePage } from '@/components/Auth';
|
| 2 |
+
|
| 3 |
+
const AuthLayout: React.FC<React.PropsWithChildren> = ({ children }) => {
|
| 4 |
+
return <WelcomePage>{children}</WelcomePage>;
|
| 5 |
+
};
|
| 6 |
+
|
| 7 |
+
export default AuthLayout;
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(auth)/login/Login.tsx
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use client';
|
| 2 |
+
|
| 3 |
+
import { useParams, useRouter } from 'next/navigation';
|
| 4 |
+
import { useMemo, useState } from 'react';
|
| 5 |
+
import { SubmitHandler, useForm } from 'react-hook-form';
|
| 6 |
+
|
| 7 |
+
import { CohereUnauthorizedError, ListAuthStrategy } from '@/cohere-client';
|
| 8 |
+
import { AuthLink, OidcSSOButton } from '@/components/Auth';
|
| 9 |
+
import { Button, Input, Text } from '@/components/UI';
|
| 10 |
+
import { useAuthConfig, useNotify, useOidcAuthRoute, useSession } from '@/hooks';
|
| 11 |
+
import type { NoNullProperties } from '@/types/util';
|
| 12 |
+
import { getQueryString, simpleEmailValidation } from '@/utils';
|
| 13 |
+
|
| 14 |
+
interface Credentials {
|
| 15 |
+
email: string;
|
| 16 |
+
password: string;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
type LoginStatus = 'idle' | 'pending';
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* @description The login page supports logging in with an email and password.
|
| 23 |
+
*/
|
| 24 |
+
const Login: React.FC = () => {
|
| 25 |
+
const params = useParams();
|
| 26 |
+
const router = useRouter();
|
| 27 |
+
const { loginMutation } = useSession();
|
| 28 |
+
const { loginStrategies } = useAuthConfig();
|
| 29 |
+
const { oidcAuth } = useOidcAuthRoute();
|
| 30 |
+
|
| 31 |
+
const notify = useNotify();
|
| 32 |
+
const loginStatus: LoginStatus = loginMutation.isPending ? 'pending' : 'idle';
|
| 33 |
+
|
| 34 |
+
const { register, handleSubmit, formState } = useForm<Credentials>();
|
| 35 |
+
const redirect = getQueryString(params.redirect_uri);
|
| 36 |
+
const hasBasicAuth = loginStrategies.some((login) => login.strategy.toLowerCase() === 'basic');
|
| 37 |
+
const ssoStrategies = useMemo(() => {
|
| 38 |
+
return (
|
| 39 |
+
loginStrategies
|
| 40 |
+
? loginStrategies.filter(
|
| 41 |
+
(strategy) =>
|
| 42 |
+
strategy.strategy !== 'Basic' &&
|
| 43 |
+
strategy.client_id !== null &&
|
| 44 |
+
strategy.authorization_endpoint !== null
|
| 45 |
+
)
|
| 46 |
+
: []
|
| 47 |
+
) as NoNullProperties<ListAuthStrategy>[];
|
| 48 |
+
}, [loginStrategies]);
|
| 49 |
+
const [errors, setErrors] = useState<string[]>([]);
|
| 50 |
+
|
| 51 |
+
const onSubmit: SubmitHandler<Credentials> = async (data) => {
|
| 52 |
+
const { email, password } = data;
|
| 53 |
+
try {
|
| 54 |
+
await loginMutation.mutateAsync(
|
| 55 |
+
{ email, password },
|
| 56 |
+
{
|
| 57 |
+
onSuccess: () => {
|
| 58 |
+
router.push(redirect || '/');
|
| 59 |
+
},
|
| 60 |
+
onError: (error) => {
|
| 61 |
+
if (error instanceof CohereUnauthorizedError) {
|
| 62 |
+
setErrors([...errors, 'Invalid email or password']);
|
| 63 |
+
}
|
| 64 |
+
},
|
| 65 |
+
}
|
| 66 |
+
);
|
| 67 |
+
} catch (error) {
|
| 68 |
+
console.error(error);
|
| 69 |
+
notify.error('An error occurred while logging in');
|
| 70 |
+
}
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
const oidcAuthStart = (strategy: string, authorizationEndpoint: string, pkceEnabled: boolean) => {
|
| 74 |
+
oidcAuth.start({
|
| 75 |
+
redirect,
|
| 76 |
+
strategy,
|
| 77 |
+
authorizationEndpoint,
|
| 78 |
+
pkceEnabled,
|
| 79 |
+
});
|
| 80 |
+
};
|
| 81 |
+
|
| 82 |
+
return (
|
| 83 |
+
<div className="flex flex-col items-center justify-center">
|
| 84 |
+
<Text as="h1" styleAs="h3">
|
| 85 |
+
Log in
|
| 86 |
+
</Text>
|
| 87 |
+
<div className="mt-10 flex w-full flex-col items-center gap-1">
|
| 88 |
+
{ssoStrategies.map((ssoConfig) => (
|
| 89 |
+
<OidcSSOButton
|
| 90 |
+
key={ssoConfig.strategy}
|
| 91 |
+
className="inline-flex w-full flex-auto"
|
| 92 |
+
service={ssoConfig.strategy}
|
| 93 |
+
onClick={() =>
|
| 94 |
+
oidcAuthStart(
|
| 95 |
+
ssoConfig.strategy,
|
| 96 |
+
ssoConfig.authorization_endpoint,
|
| 97 |
+
ssoConfig.pkce_enabled
|
| 98 |
+
)
|
| 99 |
+
}
|
| 100 |
+
/>
|
| 101 |
+
))}
|
| 102 |
+
</div>
|
| 103 |
+
|
| 104 |
+
{hasBasicAuth && (
|
| 105 |
+
<>
|
| 106 |
+
<form
|
| 107 |
+
onSubmit={handleSubmit(onSubmit)}
|
| 108 |
+
onChange={() => setErrors([])}
|
| 109 |
+
className="mt-10 flex w-full flex-col gap-4"
|
| 110 |
+
>
|
| 111 |
+
<Input
|
| 112 |
+
className="w-full"
|
| 113 |
+
label="Email"
|
| 114 |
+
placeholder="yourname@email.com"
|
| 115 |
+
type="email"
|
| 116 |
+
errorText={
|
| 117 |
+
!!formState.errors.email ? 'Please enter a valid email address' : undefined
|
| 118 |
+
}
|
| 119 |
+
{...register('email', {
|
| 120 |
+
required: true,
|
| 121 |
+
validate: (value) => simpleEmailValidation(value),
|
| 122 |
+
})}
|
| 123 |
+
/>
|
| 124 |
+
|
| 125 |
+
<Input
|
| 126 |
+
className="mb-2 w-full"
|
| 127 |
+
label="Password"
|
| 128 |
+
placeholder="••••••••••••"
|
| 129 |
+
type="password"
|
| 130 |
+
actionType="reveal"
|
| 131 |
+
errorText={!!formState.errors.password ? 'Please enter a valid password' : undefined}
|
| 132 |
+
{...register('password', { required: true })}
|
| 133 |
+
/>
|
| 134 |
+
|
| 135 |
+
{errors.map(
|
| 136 |
+
(error) =>
|
| 137 |
+
error && (
|
| 138 |
+
<Text key={error} className="mt-4 text-danger-350 first-letter:uppercase">
|
| 139 |
+
{error}
|
| 140 |
+
</Text>
|
| 141 |
+
)
|
| 142 |
+
)}
|
| 143 |
+
|
| 144 |
+
<Button
|
| 145 |
+
disabled={loginStatus === 'pending' || !formState.isValid}
|
| 146 |
+
label={loginStatus === 'pending' ? 'Logging in...' : 'Log in'}
|
| 147 |
+
buttonType="submit"
|
| 148 |
+
kind="cell"
|
| 149 |
+
theme="evolved-green"
|
| 150 |
+
iconPosition="end"
|
| 151 |
+
className="mt-10 w-full self-center md:w-fit"
|
| 152 |
+
/>
|
| 153 |
+
</form>
|
| 154 |
+
|
| 155 |
+
<Text
|
| 156 |
+
as="div"
|
| 157 |
+
className="mt-10 flex w-full items-center justify-center gap-2 text-volcanic-700"
|
| 158 |
+
>
|
| 159 |
+
New user?
|
| 160 |
+
<AuthLink
|
| 161 |
+
redirect={redirect !== '/' ? redirect : undefined}
|
| 162 |
+
action="register"
|
| 163 |
+
theme="evolved-green"
|
| 164 |
+
/>
|
| 165 |
+
</Text>
|
| 166 |
+
</>
|
| 167 |
+
)}
|
| 168 |
+
</div>
|
| 169 |
+
);
|
| 170 |
+
};
|
| 171 |
+
|
| 172 |
+
export default Login;
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(auth)/login/page.tsx
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Metadata, NextPage } from 'next';
|
| 2 |
+
|
| 3 |
+
import Login from './Login';
|
| 4 |
+
|
| 5 |
+
export const metadata: Metadata = {
|
| 6 |
+
title: 'Login',
|
| 7 |
+
};
|
| 8 |
+
|
| 9 |
+
const LoginPage: NextPage = () => {
|
| 10 |
+
return <Login />;
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
export default LoginPage;
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(auth)/logout/Logout.tsx
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use client';
|
| 2 |
+
|
| 3 |
+
import { useRouter } from 'next/navigation';
|
| 4 |
+
import { useEffect } from 'react';
|
| 5 |
+
|
| 6 |
+
import { Text } from '@/components/UI';
|
| 7 |
+
import { useSession } from '@/hooks';
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* @description The login page supports logging in with an email and password.
|
| 11 |
+
*/
|
| 12 |
+
const Logout = () => {
|
| 13 |
+
const router = useRouter();
|
| 14 |
+
const { logoutMutation } = useSession();
|
| 15 |
+
|
| 16 |
+
useEffect(() => {
|
| 17 |
+
logoutMutation.mutate(undefined, {
|
| 18 |
+
onSettled: () => {
|
| 19 |
+
router.push('/login');
|
| 20 |
+
},
|
| 21 |
+
});
|
| 22 |
+
}, []);
|
| 23 |
+
|
| 24 |
+
return (
|
| 25 |
+
<div className="flex flex-col items-center justify-center">
|
| 26 |
+
<Text as="h1" styleAs="h3">
|
| 27 |
+
Logging out
|
| 28 |
+
</Text>
|
| 29 |
+
</div>
|
| 30 |
+
);
|
| 31 |
+
};
|
| 32 |
+
|
| 33 |
+
export default Logout;
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(auth)/logout/page.tsx
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Metadata } from 'next';
|
| 2 |
+
|
| 3 |
+
import Logout from './Logout';
|
| 4 |
+
|
| 5 |
+
export const metadata: Metadata = {
|
| 6 |
+
title: 'Logout',
|
| 7 |
+
};
|
| 8 |
+
|
| 9 |
+
const LogoutPage = () => {
|
| 10 |
+
return <Logout />;
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
export default LogoutPage;
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(auth)/register/Register.tsx
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use client';
|
| 2 |
+
|
| 3 |
+
import { useRouter, useSearchParams } from 'next/navigation';
|
| 4 |
+
import { SubmitHandler, useForm } from 'react-hook-form';
|
| 5 |
+
|
| 6 |
+
import { AuthLink } from '@/components/Auth';
|
| 7 |
+
import { Button, Input, Text } from '@/components/UI';
|
| 8 |
+
import { useSession } from '@/hooks';
|
| 9 |
+
import { getQueryString, simpleEmailValidation } from '@/utils';
|
| 10 |
+
|
| 11 |
+
interface Credentials {
|
| 12 |
+
name: string;
|
| 13 |
+
email: string;
|
| 14 |
+
password: string;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
type RegisterStatus = 'idle' | 'pending';
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* @description The register page supports creating an account with an email and password.
|
| 21 |
+
*/
|
| 22 |
+
const Register: React.FC = () => {
|
| 23 |
+
const router = useRouter();
|
| 24 |
+
const search = useSearchParams();
|
| 25 |
+
|
| 26 |
+
const { registerMutation } = useSession();
|
| 27 |
+
|
| 28 |
+
const registerStatus: RegisterStatus = registerMutation.isPending ? 'pending' : 'idle';
|
| 29 |
+
const { register, handleSubmit, formState } = useForm<Credentials>();
|
| 30 |
+
|
| 31 |
+
const onSubmit: SubmitHandler<Credentials> = async (data) => {
|
| 32 |
+
const { name, email, password } = data;
|
| 33 |
+
try {
|
| 34 |
+
await registerMutation.mutateAsync(
|
| 35 |
+
{ name, email, password },
|
| 36 |
+
{ onSuccess: () => router.push('/login') }
|
| 37 |
+
);
|
| 38 |
+
} catch (error) {
|
| 39 |
+
console.error(error);
|
| 40 |
+
}
|
| 41 |
+
};
|
| 42 |
+
|
| 43 |
+
const redirect = getQueryString(search.get('redirect_uri'));
|
| 44 |
+
|
| 45 |
+
const errors: string[] = [];
|
| 46 |
+
|
| 47 |
+
return (
|
| 48 |
+
<div className="flex flex-col items-center justify-center">
|
| 49 |
+
<Text as="h1" styleAs="h3">
|
| 50 |
+
Create your account
|
| 51 |
+
</Text>
|
| 52 |
+
|
| 53 |
+
<form onSubmit={handleSubmit(onSubmit)} className="mt-10 flex w-full flex-col gap-4">
|
| 54 |
+
<Input
|
| 55 |
+
className="w-full"
|
| 56 |
+
label="name"
|
| 57 |
+
placeholder="Your Name"
|
| 58 |
+
type="text"
|
| 59 |
+
errorText={!!formState.errors.name ? 'Please enter a name' : undefined}
|
| 60 |
+
{...register('name', {
|
| 61 |
+
required: true,
|
| 62 |
+
validate: (value) => !!value.trim(),
|
| 63 |
+
})}
|
| 64 |
+
/>
|
| 65 |
+
|
| 66 |
+
<Input
|
| 67 |
+
className="w-full"
|
| 68 |
+
label="Email"
|
| 69 |
+
placeholder="yourname@email.com"
|
| 70 |
+
type="email"
|
| 71 |
+
errorText={!!formState.errors.email ? 'Please enter a valid email address' : undefined}
|
| 72 |
+
{...register('email', {
|
| 73 |
+
required: true,
|
| 74 |
+
validate: (value) => simpleEmailValidation(value),
|
| 75 |
+
})}
|
| 76 |
+
/>
|
| 77 |
+
|
| 78 |
+
<Input
|
| 79 |
+
className="mb-2 w-full"
|
| 80 |
+
label="Password"
|
| 81 |
+
placeholder="••••••••••••"
|
| 82 |
+
type="password"
|
| 83 |
+
actionType="reveal"
|
| 84 |
+
errorText={!!formState.errors.password ? 'Please enter a valid password' : undefined}
|
| 85 |
+
{...register('password', { required: true })}
|
| 86 |
+
/>
|
| 87 |
+
|
| 88 |
+
{errors.map(
|
| 89 |
+
(error) =>
|
| 90 |
+
error && (
|
| 91 |
+
<Text key={error} className="mt-4 text-danger-350 first-letter:uppercase">
|
| 92 |
+
{error}
|
| 93 |
+
</Text>
|
| 94 |
+
)
|
| 95 |
+
)}
|
| 96 |
+
|
| 97 |
+
<Button
|
| 98 |
+
disabled={registerStatus === 'pending' || !formState.isValid}
|
| 99 |
+
label={registerStatus === 'pending' ? 'Logging in...' : 'Sign up'}
|
| 100 |
+
buttonType="submit"
|
| 101 |
+
theme="evolved-green"
|
| 102 |
+
kind="cell"
|
| 103 |
+
iconPosition="end"
|
| 104 |
+
className="w-full self-center md:w-fit"
|
| 105 |
+
/>
|
| 106 |
+
</form>
|
| 107 |
+
|
| 108 |
+
<Text
|
| 109 |
+
as="div"
|
| 110 |
+
className="mt-10 flex w-full items-center justify-center gap-2 text-volcanic-400 dark:text-marble-950"
|
| 111 |
+
>
|
| 112 |
+
Already have an account?
|
| 113 |
+
<AuthLink
|
| 114 |
+
redirect={redirect !== '/' ? redirect : undefined}
|
| 115 |
+
action="login"
|
| 116 |
+
theme="evolved-green"
|
| 117 |
+
/>
|
| 118 |
+
</Text>
|
| 119 |
+
</div>
|
| 120 |
+
);
|
| 121 |
+
};
|
| 122 |
+
|
| 123 |
+
export default Register;
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(auth)/register/page.tsx
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Metadata } from 'next';
|
| 2 |
+
import { Suspense } from 'react';
|
| 3 |
+
|
| 4 |
+
import Register from './Register';
|
| 5 |
+
|
| 6 |
+
export const metadata: Metadata = {
|
| 7 |
+
title: 'Register',
|
| 8 |
+
};
|
| 9 |
+
|
| 10 |
+
const RegisterPage = () => {
|
| 11 |
+
return (
|
| 12 |
+
<Suspense>
|
| 13 |
+
<Register />
|
| 14 |
+
</Suspense>
|
| 15 |
+
);
|
| 16 |
+
};
|
| 17 |
+
|
| 18 |
+
export default RegisterPage;
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(main)/(chat)/Chat.tsx
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use client';
|
| 2 |
+
|
| 3 |
+
import { useEffect } from 'react';
|
| 4 |
+
|
| 5 |
+
import { Document, ToolDefinition } from '@/cohere-client';
|
| 6 |
+
import { Conversation, ConversationError } from '@/components/Conversation';
|
| 7 |
+
import { TOOL_PYTHON_INTERPRETER_ID } from '@/constants';
|
| 8 |
+
import { useAgent, useAvailableTools, useConversation, useListTools } from '@/hooks';
|
| 9 |
+
import { useCitationsStore, useConversationStore, useParamsStore } from '@/stores';
|
| 10 |
+
import { OutputFiles } from '@/stores/slices/citationsSlice';
|
| 11 |
+
import {
|
| 12 |
+
createStartEndKey,
|
| 13 |
+
fixInlineCitationsForMarkdown,
|
| 14 |
+
mapHistoryToMessages,
|
| 15 |
+
parsePythonInterpreterToolFields,
|
| 16 |
+
} from '@/utils';
|
| 17 |
+
|
| 18 |
+
const Chat: React.FC<{ agentId?: string; conversationId?: string }> = ({
|
| 19 |
+
agentId,
|
| 20 |
+
conversationId,
|
| 21 |
+
}) => {
|
| 22 |
+
const { data: agent } = useAgent({ agentId });
|
| 23 |
+
const { data: tools } = useListTools();
|
| 24 |
+
const { setConversation } = useConversationStore();
|
| 25 |
+
const { addCitation, saveOutputFiles } = useCitationsStore();
|
| 26 |
+
const { setParams, resetFileParams } = useParamsStore();
|
| 27 |
+
const { availableTools } = useAvailableTools({ agent, allTools: tools });
|
| 28 |
+
|
| 29 |
+
const {
|
| 30 |
+
data: conversation,
|
| 31 |
+
isError,
|
| 32 |
+
error,
|
| 33 |
+
} = useConversation({
|
| 34 |
+
conversationId: conversationId,
|
| 35 |
+
});
|
| 36 |
+
|
| 37 |
+
// Reset citations and file params when switching between conversations
|
| 38 |
+
useEffect(() => {
|
| 39 |
+
resetFileParams();
|
| 40 |
+
|
| 41 |
+
const agentTools =
|
| 42 |
+
agent?.tools &&
|
| 43 |
+
(agent.tools
|
| 44 |
+
.map((name) => (tools ?? [])?.find((t) => t.name === name))
|
| 45 |
+
.filter(
|
| 46 |
+
(t) => t !== undefined && availableTools.some((at) => at.name === t?.name)
|
| 47 |
+
) as ToolDefinition[]);
|
| 48 |
+
|
| 49 |
+
const fileIds = conversation?.files.map((file) => file.id);
|
| 50 |
+
|
| 51 |
+
setParams({
|
| 52 |
+
temperature: agent?.temperature,
|
| 53 |
+
tools: agentTools,
|
| 54 |
+
fileIds,
|
| 55 |
+
});
|
| 56 |
+
|
| 57 |
+
if (conversationId) {
|
| 58 |
+
setConversation({ id: conversationId });
|
| 59 |
+
}
|
| 60 |
+
}, [
|
| 61 |
+
agent,
|
| 62 |
+
tools,
|
| 63 |
+
conversation,
|
| 64 |
+
availableTools,
|
| 65 |
+
setParams,
|
| 66 |
+
resetFileParams,
|
| 67 |
+
setConversation,
|
| 68 |
+
conversationId,
|
| 69 |
+
]);
|
| 70 |
+
|
| 71 |
+
useEffect(() => {
|
| 72 |
+
if (!conversation) return;
|
| 73 |
+
|
| 74 |
+
const messages = mapHistoryToMessages(
|
| 75 |
+
conversation?.messages?.sort((a, b) => a.position - b.position)
|
| 76 |
+
);
|
| 77 |
+
|
| 78 |
+
setConversation({ name: conversation.title, messages });
|
| 79 |
+
|
| 80 |
+
let documentsMap: { [documentId: string]: Document } = {};
|
| 81 |
+
let outputFilesMap: OutputFiles = {};
|
| 82 |
+
|
| 83 |
+
(conversation?.messages ?? []).forEach((message) => {
|
| 84 |
+
message.documents?.forEach((doc) => {
|
| 85 |
+
const docId = doc.document_id ?? '';
|
| 86 |
+
documentsMap[docId] = doc;
|
| 87 |
+
|
| 88 |
+
const toolName = (doc.tool_name ?? '').toLowerCase();
|
| 89 |
+
|
| 90 |
+
if (toolName === TOOL_PYTHON_INTERPRETER_ID) {
|
| 91 |
+
const { outputFile } = parsePythonInterpreterToolFields(doc);
|
| 92 |
+
|
| 93 |
+
if (outputFile) {
|
| 94 |
+
outputFilesMap[outputFile.filename] = {
|
| 95 |
+
name: outputFile.filename,
|
| 96 |
+
data: outputFile.b64_data,
|
| 97 |
+
documentId: docId,
|
| 98 |
+
};
|
| 99 |
+
}
|
| 100 |
+
}
|
| 101 |
+
});
|
| 102 |
+
fixInlineCitationsForMarkdown(message.citations, message.text)?.forEach((citation) => {
|
| 103 |
+
const startEndKey = createStartEndKey(citation.start ?? 0, citation.end ?? 0);
|
| 104 |
+
const documents = citation.document_ids?.map((id) => documentsMap[id]) ?? [];
|
| 105 |
+
addCitation(message.generation_id ?? '', startEndKey, documents);
|
| 106 |
+
});
|
| 107 |
+
});
|
| 108 |
+
|
| 109 |
+
saveOutputFiles(outputFilesMap);
|
| 110 |
+
}, [conversation?.id, conversation?.messages.length, setConversation]);
|
| 111 |
+
|
| 112 |
+
return isError ? (
|
| 113 |
+
<ConversationError error={error} />
|
| 114 |
+
) : (
|
| 115 |
+
<Conversation agent={agent} tools={tools} startOptionsEnabled />
|
| 116 |
+
);
|
| 117 |
+
};
|
| 118 |
+
|
| 119 |
+
export default Chat;
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(main)/(chat)/a/[agentId]/c/[conversationId]/loading.tsx
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Spinner } from '@/components/UI';
|
| 2 |
+
|
| 3 |
+
const Loading: React.FC<React.PropsWithChildren> = () => {
|
| 4 |
+
return (
|
| 5 |
+
<div className="flex h-screen w-full items-center justify-center bg-marble-980 dark:bg-volcanic-150">
|
| 6 |
+
<Spinner className="h-10 w-10" />
|
| 7 |
+
</div>
|
| 8 |
+
);
|
| 9 |
+
};
|
| 10 |
+
|
| 11 |
+
export default Loading;
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(main)/(chat)/a/[agentId]/c/[conversationId]/page.tsx
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { HydrationBoundary, QueryClient, dehydrate } from '@tanstack/react-query';
|
| 2 |
+
import { NextPage } from 'next';
|
| 3 |
+
|
| 4 |
+
import Chat from '@/app/(main)/(chat)/Chat';
|
| 5 |
+
import { getCohereServerClient } from '@/server/cohereServerClient';
|
| 6 |
+
|
| 7 |
+
type Props = {
|
| 8 |
+
params: {
|
| 9 |
+
agentId: string;
|
| 10 |
+
conversationId: string;
|
| 11 |
+
};
|
| 12 |
+
searchParams: Record<string, string>;
|
| 13 |
+
};
|
| 14 |
+
|
| 15 |
+
const Page: NextPage<Props> = async ({ params }) => {
|
| 16 |
+
const cohereServerClient = getCohereServerClient();
|
| 17 |
+
const queryClient = new QueryClient();
|
| 18 |
+
|
| 19 |
+
await Promise.all([
|
| 20 |
+
queryClient.prefetchQuery({
|
| 21 |
+
queryKey: ['conversation', params.conversationId],
|
| 22 |
+
queryFn: async () =>
|
| 23 |
+
cohereServerClient.getConversation({ conversationId: params.conversationId }),
|
| 24 |
+
}),
|
| 25 |
+
queryClient.prefetchQuery({
|
| 26 |
+
queryKey: ['agent', params.agentId],
|
| 27 |
+
queryFn: async () => cohereServerClient.getAgent(params.agentId),
|
| 28 |
+
}),
|
| 29 |
+
]);
|
| 30 |
+
|
| 31 |
+
return (
|
| 32 |
+
<HydrationBoundary state={dehydrate(queryClient)}>
|
| 33 |
+
<Chat conversationId={params.conversationId} agentId={params.agentId} />
|
| 34 |
+
</HydrationBoundary>
|
| 35 |
+
);
|
| 36 |
+
};
|
| 37 |
+
|
| 38 |
+
export default Page;
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(main)/(chat)/a/[agentId]/loading.tsx
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Spinner } from '@/components/UI';
|
| 2 |
+
|
| 3 |
+
const Loading: React.FC<React.PropsWithChildren> = () => {
|
| 4 |
+
return (
|
| 5 |
+
<div className="flex h-screen w-full items-center justify-center bg-marble-980 dark:bg-volcanic-150">
|
| 6 |
+
<Spinner className="h-10 w-10" />
|
| 7 |
+
</div>
|
| 8 |
+
);
|
| 9 |
+
};
|
| 10 |
+
|
| 11 |
+
export default Loading;
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(main)/(chat)/a/[agentId]/page.tsx
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { HydrationBoundary, QueryClient, dehydrate } from '@tanstack/react-query';
|
| 2 |
+
import { NextPage } from 'next';
|
| 3 |
+
|
| 4 |
+
import Chat from '@/app/(main)/(chat)/Chat';
|
| 5 |
+
import { getCohereServerClient } from '@/server/cohereServerClient';
|
| 6 |
+
|
| 7 |
+
type Props = {
|
| 8 |
+
params: {
|
| 9 |
+
agentId: string;
|
| 10 |
+
};
|
| 11 |
+
searchParams: Record<string, string>;
|
| 12 |
+
};
|
| 13 |
+
|
| 14 |
+
const Page: NextPage<Props> = async ({ params }) => {
|
| 15 |
+
const cohereServerClient = getCohereServerClient();
|
| 16 |
+
const queryClient = new QueryClient();
|
| 17 |
+
|
| 18 |
+
await queryClient.prefetchQuery({
|
| 19 |
+
queryKey: ['agent', params.agentId],
|
| 20 |
+
queryFn: async () => cohereServerClient.getAgent(params.agentId),
|
| 21 |
+
});
|
| 22 |
+
|
| 23 |
+
return (
|
| 24 |
+
<HydrationBoundary state={dehydrate(queryClient)}>
|
| 25 |
+
<Chat agentId={params.agentId} />
|
| 26 |
+
</HydrationBoundary>
|
| 27 |
+
);
|
| 28 |
+
};
|
| 29 |
+
|
| 30 |
+
export default Page;
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(main)/(chat)/c/[conversationId]/loading.tsx
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Spinner } from '@/components/UI';
|
| 2 |
+
|
| 3 |
+
const Loading: React.FC<React.PropsWithChildren> = () => {
|
| 4 |
+
return (
|
| 5 |
+
<div className="flex h-screen w-full items-center justify-center bg-marble-980 dark:bg-volcanic-150">
|
| 6 |
+
<Spinner className="h-10 w-10" />
|
| 7 |
+
</div>
|
| 8 |
+
);
|
| 9 |
+
};
|
| 10 |
+
|
| 11 |
+
export default Loading;
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(main)/(chat)/c/[conversationId]/page.tsx
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { HydrationBoundary, QueryClient, dehydrate } from '@tanstack/react-query';
|
| 2 |
+
import { NextPage } from 'next';
|
| 3 |
+
|
| 4 |
+
import Chat from '@/app/(main)/(chat)/Chat';
|
| 5 |
+
import { DEFAULT_AGENT_ID } from '@/constants';
|
| 6 |
+
import { getCohereServerClient } from '@/server/cohereServerClient';
|
| 7 |
+
|
| 8 |
+
type Props = {
|
| 9 |
+
params: {
|
| 10 |
+
conversationId: string;
|
| 11 |
+
};
|
| 12 |
+
searchParams: Record<string, string>;
|
| 13 |
+
};
|
| 14 |
+
|
| 15 |
+
const Page: NextPage<Props> = async ({ params }) => {
|
| 16 |
+
const cohereServerClient = getCohereServerClient();
|
| 17 |
+
const queryClient = new QueryClient();
|
| 18 |
+
|
| 19 |
+
await Promise.all([
|
| 20 |
+
queryClient.prefetchQuery({
|
| 21 |
+
queryKey: ['conversation', params.conversationId],
|
| 22 |
+
queryFn: async () =>
|
| 23 |
+
cohereServerClient.getConversation({ conversationId: params.conversationId }),
|
| 24 |
+
}),
|
| 25 |
+
queryClient.prefetchQuery({
|
| 26 |
+
queryKey: ['agent', DEFAULT_AGENT_ID],
|
| 27 |
+
queryFn: () => cohereServerClient.getDefaultAgent(),
|
| 28 |
+
}),
|
| 29 |
+
]);
|
| 30 |
+
|
| 31 |
+
return (
|
| 32 |
+
<HydrationBoundary state={dehydrate(queryClient)}>
|
| 33 |
+
<Chat conversationId={params.conversationId} />
|
| 34 |
+
</HydrationBoundary>
|
| 35 |
+
);
|
| 36 |
+
};
|
| 37 |
+
|
| 38 |
+
export default Page;
|
global_ai/canada/cohere-toolkit/src/interfaces/assistants_web/src/app/(main)/(chat)/layout.tsx
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use client';
|
| 2 |
+
|
| 3 |
+
import { Transition } from '@headlessui/react';
|
| 4 |
+
import { useEffect } from 'react';
|
| 5 |
+
|
| 6 |
+
import { ConversationPanel } from '@/components/Conversation';
|
| 7 |
+
import { useIsDesktop, useListAllDeployments } from '@/hooks';
|
| 8 |
+
import { useConversationStore, useParamsStore, useSettingsStore } from '@/stores';
|
| 9 |
+
import { cn } from '@/utils';
|
| 10 |
+
|
| 11 |
+
const ChatLayout: React.FC<React.PropsWithChildren> = ({ children }) => {
|
| 12 |
+
const { resetConversation } = useConversationStore();
|
| 13 |
+
const {
|
| 14 |
+
params: { deployment },
|
| 15 |
+
setParams,
|
| 16 |
+
} = useParamsStore();
|
| 17 |
+
const { data: allDeployments } = useListAllDeployments();
|
| 18 |
+
|
| 19 |
+
const { isRightPanelOpen } = useSettingsStore();
|
| 20 |
+
const isDesktop = useIsDesktop();
|
| 21 |
+
|
| 22 |
+
// Reset conversation when unmounting
|
| 23 |
+
useEffect(() => {
|
| 24 |
+
return () => {
|
| 25 |
+
resetConversation();
|
| 26 |
+
};
|
| 27 |
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
| 28 |
+
}, []);
|
| 29 |
+
|
| 30 |
+
useEffect(() => {
|
| 31 |
+
if (!deployment && allDeployments) {
|
| 32 |
+
const firstAvailableDeployment = allDeployments.find((d) => d.is_available);
|
| 33 |
+
if (firstAvailableDeployment) {
|
| 34 |
+
setParams({ deployment: firstAvailableDeployment.name });
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
| 38 |
+
}, [deployment, allDeployments]);
|
| 39 |
+
|
| 40 |
+
return (
|
| 41 |
+
<div className="relative flex h-full">
|
| 42 |
+
{children}
|
| 43 |
+
<Transition
|
| 44 |
+
show={isRightPanelOpen || isDesktop}
|
| 45 |
+
as="div"
|
| 46 |
+
className={cn(
|
| 47 |
+
'border-marble-950 bg-marble-980 px-6 dark:border-volcanic-200 dark:bg-volcanic-100',
|
| 48 |
+
'absolute inset-0 rounded-lg border lg:static lg:w-[360px] lg:rounded-none lg:rounded-r-lg lg:border-y lg:border-l-0 lg:border-r'
|
| 49 |
+
)}
|
| 50 |
+
enter="transition-all transform ease-in-out duration-300"
|
| 51 |
+
enterFrom="translate-x-full"
|
| 52 |
+
enterTo="translate-x-0"
|
| 53 |
+
leave="transition-all transform ease-in-out duration-300"
|
| 54 |
+
leaveFrom="translate-x-0 opacity-100"
|
| 55 |
+
leaveTo="translate-x-full opacity-0"
|
| 56 |
+
>
|
| 57 |
+
<ConversationPanel />
|
| 58 |
+
</Transition>
|
| 59 |
+
</div>
|
| 60 |
+
);
|
| 61 |
+
};
|
| 62 |
+
|
| 63 |
+
export default ChatLayout;
|