Repository: symphony-hq/symphony Branch: main Commit: f1f220210368 Files: 35 Total size: 92.3 KB Directory structure: gitextract_umptbr62/ ├── .eslintrc.js ├── .gitignore ├── .prettierrc ├── LICENSE.md ├── README.md ├── functions/ │ ├── getCoordinates.py │ ├── getWeather.ts │ └── kelvinToCelsius.ts ├── interfaces/ │ ├── getCoordinates-py.tsx │ ├── getWeather-ts.tsx │ └── kelvinToCelsius-ts.tsx ├── package-scripts.js ├── package.json ├── requirements.txt ├── symphony/ │ ├── client/ │ │ ├── colors.scss │ │ ├── index.html │ │ ├── index.scss │ │ └── index.tsx │ ├── database/ │ │ ├── destroy.sh │ │ ├── postgrest.conf │ │ └── setup.sh │ ├── server/ │ │ ├── jig.ts │ │ ├── python/ │ │ │ ├── describe.py │ │ │ ├── descriptions.json │ │ │ └── serve.py │ │ ├── service.ts │ │ ├── typescript/ │ │ │ ├── describe.ts │ │ │ ├── descriptions.json │ │ │ └── serve.ts │ │ └── watch.ts │ └── utils/ │ ├── functions.ts │ └── types.ts ├── tsconfig.json ├── tsconfig.node.json └── vite.config.ts ================================================ FILE CONTENTS ================================================ ================================================ FILE: .eslintrc.js ================================================ module.exports = { root: true, env: { browser: true, es2020: true }, extends: [ "eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:react-hooks/recommended", "plugin:prettier/recommended", ], ignorePatterns: [".eslintrc.js", "package-scripts.js"], parser: "@typescript-eslint/parser", plugins: ["react-refresh", "prettier"], rules: { "prettier/prettier": "error", }, }; ================================================ FILE: .gitignore ================================================ /node_modules /venv .DS_Store .env npm-debug.log* yarn-debug.log* yarn-error.log* __pycache__/ training-data.jsonl symphony/*.js ================================================ FILE: .prettierrc ================================================ { "endOfLine": "lf", "semi": true, "singleQuote": false, "tabWidth": 2, "trailingComma": "es5", "bracketSpacing": true } ================================================ FILE: LICENSE.md ================================================ MIT License Copyright (c) 2023 Jeremy Philemon Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ ![symphony preview](https://github.com/symphony-hq/symphony/assets/17938322/5aa7b5ee-79de-4fd7-a793-368c1a453b12) ## Getting Started Visit https://symphony.run/docs to get started with Symphony. ## Contributing Open to improvements and bug fixes! ================================================ FILE: functions/getCoordinates.py ================================================ from typing import Optional, TypedDict import geocoder import json import sys from pydantic import Field, BaseModel class SymphonyRequest(BaseModel): ipAddress: str = Field( description="The IP address; Use 'me' to get own IP address") class SymphonyResponse(BaseModel): lat: float = Field(description="The latitude of IP address") lng: float = Field(description="The longitude of IP address") def handler(request: SymphonyRequest) -> SymphonyResponse: """ Get latitude and longitude from IP address """ ipAddress = request['ipAddress'] g = geocoder.ip(ipAddress) lat, lng = g.latlng return SymphonyResponse(lat=lat, lng=lng) ================================================ FILE: functions/getWeather.ts ================================================ import axios from "axios"; /** * lat: Latitude of the city * lon: Longitude of the city */ interface SymphonyRequest { lat: number; lon: number; } /** * temperature: The temperature of the city * unit: The unit of the temperature */ interface SymphonyResponse { temperature: number; unit: string; } /** * Gets temperature of a city */ export const handler = async ( request: SymphonyRequest ): Promise => { const { lat, lon } = request; const result = await axios .get( `https://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${lon}&appid=bab3aa11dfaea12cda0525211c1cf3a5` ) .then((response) => { return response.data; }); return { temperature: result.main.temp, unit: "Kelvin", }; }; ================================================ FILE: functions/kelvinToCelsius.ts ================================================ /** * value: Value in Kelvin */ interface SymphonyRequest { value: number; } /** * value: Value in Celsius */ interface SymphonyResponse { value: number; } /** * Converts Kelvin to Celsius */ export const handler = async ( request: SymphonyRequest ): Promise => { const { value } = request; return { value: Math.round(value - 273.15), }; }; ================================================ FILE: interfaces/getCoordinates-py.tsx ================================================ import * as React from "react"; interface Request { ipAddress: string; } export function Request({ props }: { props: Request }) { return
{JSON.stringify(props, null, 2)}
; } interface Response { lat: number; lng: number; } export function Response({ props }: { props: Response }) { const { lat, lng } = props; return ( ); } ================================================ FILE: interfaces/getWeather-ts.tsx ================================================ import * as React from "react"; interface Request { lat: number; lon: number; } export function Request({ props }: { props: Request }) { return
{JSON.stringify(props, null, 2)}
; } interface Response { temperature: number; unit: string; } export function Response({ props }: { props: Response }) { return
{JSON.stringify(props, null, 2)}
; } ================================================ FILE: interfaces/kelvinToCelsius-ts.tsx ================================================ import * as React from "react"; interface Request { value: number; } export function Request({ props }: { props: Request }) { return
{JSON.stringify(props, null, 2)}
; } interface Response { value: number; } export function Response({ props }: { props: Response }) { return
{JSON.stringify(props, null, 2)}
; } ================================================ FILE: package-scripts.js ================================================ const npsUtils = require("nps-utils"); const dotenv = require("dotenv"); const config = dotenv.config(); if (config.error) { throw config.error; } let requiredEnvVariables = ["OPENAI_API_KEY"]; requiredEnvVariables.forEach((variable) => { if (!process.env[variable]) { console.error(`Missing environment variable: ${variable}`); process.exit(1); } }); module.exports = { scripts: { initialize: { py: "virtualenv -p python3 venv && source venv/bin/activate && pip install -r requirements.txt", database: "symphony/database/setup.sh", default: npsUtils.concurrent.nps("initialize.py", "initialize.database"), }, describe: { ts: "node -r @swc-node/register symphony/server/typescript/describe.ts", py: "source venv/bin/activate && python symphony/server/python/describe.py", }, serve: { ts: "node -r @swc-node/register symphony/server/typescript/serve.ts", py: "source venv/bin/activate && python symphony/server/python/serve.py", all: npsUtils.concurrent.nps("serve.ts", "serve.py"), }, jig: "node -r @swc-node/register symphony/server/jig.ts", watch: "node -r @swc-node/register symphony/server/watch.ts", client: "yarn vite --port 3000", service: "node -r @swc-node/register symphony/server/service.ts", database: "postgrest symphony/database/postgrest.conf", start: npsUtils.concurrent.nps( "client", "service", "database", "serve.all", "jig", "watch" ), lint: "eslint .", clean: { ts: "rm -rf node_modules", py: "rm -rf venv", database: "symphony/database/destroy.sh", all: npsUtils.concurrent.nps("clean.ts", "clean.py"), default: "yarn nps clean.all", }, }, }; ================================================ FILE: package.json ================================================ { "name": "symphony", "version": "1.0.0", "license": "MIT", "scripts": { "start": "nps" }, "dependencies": { "@primer/octicons-react": "^19.8.0", "@xstate/immer": "^0.3.3", "axios": "^1.5.0", "chokidar": "^3.5.3", "classnames": "^2.3.2", "date-fns": "^2.30.0", "dotenv": "^16.3.1", "fastify": "^4.24.3", "fp-ts": "^2.16.1", "immer": "^10.0.3", "nps": "^5.10.0", "nps-utils": "^1.7.0", "openai": "^4.6.0", "react": "^18.2.0", "react-dom": "^18.2.0", "sass": "^1.67.0", "uuid": "^9.0.1", "vite": "^4.4.9", "ws": "^8.14.1", "xstate": "^4.38.2" }, "devDependencies": { "@swc-node/register": "^1.6.8", "@types/node": "^20.6.0", "@types/react-dom": "^18.2.7", "@typescript-eslint/eslint-plugin": "^6.7.3", "@typescript-eslint/parser": "^6.7.3", "@vitejs/plugin-react-swc": "^3.4.0", "eslint": "^8.50.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.3", "modularscale-sass": "^3.0.10", "prettier": "^3.0.3", "ts-morph": "^20.0.0", "typescript": "^5.2.2" }, "eslintConfig": { "extends": [ "react-app" ] }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } } ================================================ FILE: requirements.txt ================================================ annotated-types==0.5.0 blinker==1.6.3 certifi==2023.7.22 charset-normalizer==3.2.0 click==8.1.7 decorator==5.1.1 Flask==3.0.0 future==0.18.3 geocoder==1.38.1 idna==3.4 itsdangerous==2.1.2 Jinja2==3.1.2 MarkupSafe==2.1.3 pydantic==2.3.0 pydantic_core==2.6.3 ratelim==0.1.6 sniffio==1.3.0 typing_extensions==4.8.0 watchdog==3.0.0 Werkzeug==3.0.1 ================================================ FILE: symphony/client/colors.scss ================================================ $slate-50: #f8fafc; $slate-100: #f1f5f9; $slate-200: #e2e8f0; $slate-300: #cbd5e1; $slate-400: #94a3b8; $slate-500: #64748b; $slate-600: #475569; $slate-700: #334155; $slate-800: #1e293b; $slate-900: #0f172a; $gray-50: #f9fafb; $gray-100: #f3f4f6; $gray-200: #e5e7eb; $gray-300: #d1d5db; $gray-400: #9ca3af; $gray-500: #6b7280; $gray-600: #4b5563; $gray-700: #374151; $gray-800: #1f2937; $gray-900: #111827; $zinc-50: #fafafa; $zinc-100: #f4f4f5; $zinc-200: #e4e4e7; $zinc-300: #d4d4d8; $zinc-400: #a1a1aa; $zinc-500: #71717a; $zinc-600: #52525b; $zinc-700: #3f3f46; $zinc-800: #27272a; $zinc-900: #18181b; $neutral-50: #fafafa; $neutral-100: #f5f5f5; $neutral-200: #e5e5e5; $neutral-300: #d4d4d4; $neutral-400: #a3a3a3; $neutral-500: #737373; $neutral-600: #525252; $neutral-700: #404040; $neutral-800: #262626; $neutral-900: #171717; $stone-50: #fafaf9; $stone-100: #f5f5f4; $stone-200: #e7e5e4; $stone-300: #d6d3d1; $stone-400: #a8a29e; $stone-500: #78716c; $stone-600: #57534e; $stone-700: #44403c; $stone-800: #292524; $stone-900: #1c1917; $red-50: #fef2f2; $red-100: #fee2e2; $red-200: #fecaca; $red-300: #fca5a5; $red-400: #f87171; $red-500: #ef4444; $red-600: #dc2626; $red-700: #b91c1c; $red-800: #991b1b; $red-900: #7f1d1d; $orange-50: #fff7ed; $orange-100: #ffedd5; $orange-200: #fed7aa; $orange-300: #fdba74; $orange-400: #fb923c; $orange-500: #f97316; $orange-600: #ea580c; $orange-700: #c2410c; $orange-800: #9a3412; $orange-900: #7c2d12; $amber-50: #fffbeb; $amber-100: #fef3c7; $amber-200: #fde68a; $amber-300: #fcd34d; $amber-400: #fbbf24; $amber-500: #f59e0b; $amber-600: #d97706; $amber-700: #b45309; $amber-800: #92400e; $amber-900: #78350f; $yellow-50: #fefce8; $yellow-100: #fef9c3; $yellow-200: #fef08a; $yellow-300: #fde047; $yellow-400: #facc15; $yellow-500: #eab308; $yellow-600: #ca8a04; $yellow-700: #a16207; $yellow-800: #854d0e; $yellow-900: #713f12; $lime-50: #f7fee7; $lime-100: #ecfccb; $lime-200: #d9f99d; $lime-300: #bef264; $lime-400: #a3e635; $lime-500: #84cc16; $lime-600: #65a30d; $lime-700: #4d7c0f; $lime-800: #3f6212; $lime-900: #365314; $green-50: #f0fdf4; $green-100: #dcfce7; $green-200: #bbf7d0; $green-300: #86efac; $green-400: #4ade80; $green-500: #22c55e; $green-600: #16a34a; $green-700: #15803d; $green-800: #166534; $green-900: #14532d; $emerald-50: #ecfdf5; $emerald-100: #d1fae5; $emerald-200: #a7f3d0; $emerald-300: #6ee7b7; $emerald-400: #34d399; $emerald-500: #10b981; $emerald-600: #059669; $emerald-700: #047857; $emerald-800: #065f46; $emerald-900: #064e3b; $teal-50: #f0fdfa; $teal-100: #ccfbf1; $teal-200: #99f6e4; $teal-300: #5eead4; $teal-400: #2dd4bf; $teal-500: #14b8a6; $teal-600: #0d9488; $teal-700: #0f766e; $teal-800: #115e59; $teal-900: #134e4a; $cyan-50: #ecfeff; $cyan-100: #cffafe; $cyan-200: #a5f3fc; $cyan-300: #67e8f9; $cyan-400: #22d3ee; $cyan-500: #06b6d4; $cyan-600: #0891b2; $cyan-700: #0e7490; $cyan-800: #155e75; $cyan-900: #164e63; $sky-50: #f0f9ff; $sky-100: #e0f2fe; $sky-200: #bae6fd; $sky-300: #7dd3fc; $sky-400: #38bdf8; $sky-500: #0ea5e9; $sky-600: #0284c7; $sky-700: #0369a1; $sky-800: #075985; $sky-900: #0c4a6e; $blue-50: #eff6ff; $blue-100: #dbeafe; $blue-200: #bfdbfe; $blue-300: #93c5fd; $blue-400: #60a5fa; $blue-500: #3b82f6; $blue-600: #2563eb; $blue-700: #1d4ed8; $blue-800: #1e40af; $blue-900: #1e3a8a; $indigo-50: #eef2ff; $indigo-100: #e0e7ff; $indigo-200: #c7d2fe; $indigo-300: #a5b4fc; $indigo-400: #818cf8; $indigo-500: #6366f1; $indigo-600: #4f46e5; $indigo-700: #4338ca; $indigo-800: #3730a3; $indigo-900: #312e81; $violet-50: #f5f3ff; $violet-100: #ede9fe; $violet-200: #ddd6fe; $violet-300: #c4b5fd; $violet-400: #a78bfa; $violet-500: #8b5cf6; $violet-600: #7c3aed; $violet-700: #6d28d9; $violet-800: #5b21b6; $violet-900: #4c1d95; $purple-50: #faf5ff; $purple-100: #f3e8ff; $purple-200: #e9d5ff; $purple-300: #d8b4fe; $purple-400: #c084fc; $purple-500: #a855f7; $purple-600: #9333ea; $purple-700: #7e22ce; $purple-800: #6b21a8; $purple-900: #581c87; $fuchsia-50: #fdf4ff; $fuchsia-100: #fae8ff; $fuchsia-200: #f5d0fe; $fuchsia-300: #f0abfc; $fuchsia-400: #e879f9; $fuchsia-500: #d946ef; $fuchsia-600: #c026d3; $fuchsia-700: #a21caf; $fuchsia-800: #86198f; $fuchsia-900: #701a75; $pink-50: #fdf2f8; $pink-100: #fce7f3; $pink-200: #fbcfe8; $pink-300: #f9a8d4; $pink-400: #f472b6; $pink-500: #ec4899; $pink-600: #db2777; $pink-700: #be185d; $pink-800: #9d174d; $pink-900: #831843; ================================================ FILE: symphony/client/index.html ================================================ Symphony
================================================ FILE: symphony/client/index.scss ================================================ @import "../node_modules/modularscale-sass/stylesheets/modularscale"; @import "colors.scss"; @font-face { font-family: "apercu"; src: url("public/fonts/apercu-regular.woff2") format("woff2"); font-style: normal; font-display: swap; } @font-face { font-family: "apercu mono"; src: url("public/fonts/apercu-mono.woff2") format("woff2"); font-style: normal; font-display: swap; } $modularscale: ( base: 16px, ratio: 1.25 ); body { margin: 0; } * { font-family: "apercu", sans-serif; } .window { display: flex; flex-direction: row; width: 100vw; height: 100dvh; .page { height: 100%; display: flex; flex-direction: column; flex-grow: 1; .navigation { display: flex; flex-direction: row; justify-content: space-between; align-items: center; padding: ms(0); background: $neutral-50; .name { font-size: ms(-1); color: $neutral-500; } .right { display: flex; flex-direction: row; gap: ms(0); .connections { display: flex; flex-direction: row-reverse; gap: ms(-6); .connection { position: relative; display: flex; flex-direction: column; align-items: center; cursor: pointer; &.selected { z-index: 999; pointer-events: none; } .avatar { width: ms(0); height: ms(0); border-radius: 50%; } .name { display: none; position: absolute; font-size: ms(-1); background: $neutral-800; padding: ms(-6) ms(-4); color: $neutral-50; border-radius: ms(-6); top: ms(2); white-space: nowrap; text-transform: capitalize; } &:hover { filter: brightness(0.9); .name { display: block; } } } } .menu { display: flex; color: $neutral-400; cursor: pointer; &:hover { color: $neutral-500; } } } } .conversation { display: flex; flex-direction: column; justify-content: flex-end; height: calc(100vh - 48.5px - 68.7px - #{ms(0)}); padding-top: ms(0); padding-left: ms(-2); padding-right: ms(-2); .generations { display: flex; flex-direction: column; overflow-y: scroll; .generation { display: flex; flex-direction: row; padding: ms(-4); gap: ms(-4); border-radius: ms(-6); cursor: pointer; &:hover, &.editing { background: $neutral-100; } .avatar { flex-shrink: 0; height: 21px; width: 21px; border-radius: ms(-8); } .content { display: flex; flex-direction: column; gap: ms(-4); white-space: pre-wrap; word-break: break-word; .tools { display: flex; flex-direction: row; gap: ms(0); overflow-x: scroll; .tool { display: flex; flex-direction: column; gap: ms(-4); flex-shrink: 0; .label { font-size: ms(-1); width: fit-content; color: $neutral-600; display: flex; flex-direction: row; color: $neutral-700; .status { padding: 2.75px ms(-6); background: $neutral-300; border-radius: ms(-8) 0 0 ms(-8); } .name { padding: 2.75px ms(-6); border-radius: 0 ms(-8) ms(-8) 0; background: $neutral-200; } } } } .json { font-family: "apercu mono", monospace; font-size: ms(-1); color: $neutral-500; margin: 0; } } .editing { width: 100%; display: flex; flex-direction: column; gap: ms(-4); .textareas { display: flex; flex-direction: row; gap: ms(0); .textarea { display: flex; flex-direction: column; flex-grow: 1; gap: ms(-4); .label { font-size: ms(-1); background: $neutral-200; width: fit-content; padding: 2.75px ms(-6); border-radius: ms(-8); color: $neutral-600; } } } .input { font-size: ms(0); resize: none; outline: none; border: none; width: 100%; padding: 0; background: transparent; font-family: "apercu mono", monospace; font-size: ms(-1); color: $neutral-500; overflow-y: hidden; } .actions { display: flex; flex-direction: row; gap: ms(-4); justify-content: flex-end; .line { width: 1px; height: calc(100%); background: $neutral-200; } .save, .discard, .delete { font-size: ms(-1); padding: ms(-4) ms(-3); border-radius: ms(-8); cursor: pointer; } .save { color: $green-700; background: $green-200; &:hover { color: $green-900; background: $green-300; } } .delete { color: $red-700; background: $red-200; &:hover { color: $red-900; background: $red-300; } } .discard { color: $neutral-700; background: $neutral-200; &:hover { color: $neutral-900; background: $neutral-300; } } } } .error { color: $red-500; font-size: ms(-1); } } } } .controls { display: flex; flex-direction: row; gap: ms(0); padding: ms(0); padding-top: ms(-2); .input { flex-grow: 1; padding: ms(-2); font-size: ms(0); border: 1px solid $neutral-300; border-radius: ms(-4); outline: none; } .send { font-size: ms(0); } } } .history { display: none; background: $neutral-900; height: calc(100dvh); flex-direction: column; overflow-y: scroll; flex-shrink: 0; width: ms(13); &.visible { display: flex; } .bar { display: flex; flex-direction: row; justify-content: space-between; align-items: center; padding: ms(0); background: $neutral-800; color: $neutral-300; font-size: ms(-1); position: sticky; top: 0; .finetune { display: flex; flex-direction: row; align-items: center; .icon { display: flex; cursor: pointer; } .tooltip { display: none; position: absolute; font-size: ms(-1); background: $neutral-600; right: ms(0) * 3; padding: ms(-6) ms(-4); color: $neutral-50; border-radius: ms(-6); white-space: nowrap; } &:hover { .tooltip { display: block; } } } } .conversations { padding: ms(-2); .line { margin: ms(-4); height: 1px; width: calc(100% - #{ms(-4) * 2}); background: $neutral-700; } .conversation { cursor: pointer; padding: ms(-4); border-radius: ms(-6); .top { display: flex; flex-direction: row; gap: ms(-4); .timestamp { font-size: ms(-1); color: $neutral-400; } .delete { display: flex; color: $neutral-500; &:hover { color: $red-500; } } } .content { color: $neutral-200; word-break: break-word; } &:hover, &.selected { background: $neutral-800; } } } } .personalize { position: absolute; left: 0; top: 0; display: flex; flex-direction: row; justify-content: center; align-items: flex-start; width: 100vw; height: calc(100dvh - 48px - ms(-2)); background: #{$neutral-900}dd; padding-top: calc(48px + ms(-2)); .connection { display: flex; flex-direction: column; width: ms(13); background-color: $neutral-50; padding: ms(-2); gap: ms(-2); border-radius: ms(-6); .top { display: flex; justify-content: space-between; .left { display: flex; flex-direction: row; align-items: center; gap: ms(-4); .avatar { width: ms(1); height: ms(1); flex-shrink: 0; border-radius: ms(-8); } .name { text-transform: capitalize; } } .model { display: flex; color: $neutral-800; border: 1px solid $neutral-200; border-radius: ms(-6); padding: ms(-6); cursor: pointer; position: relative; width: ms(9); .choice { font-size: ms(0); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } &:hover { color: $neutral-800; } .options { position: absolute; display: flex; flex-direction: column; top: calc(-#{ms(-2)} - 1px); left: ms(10); background: $neutral-800; padding: ms(-4); border-radius: ms(-6); width: ms(10); font-family: "apercu mono", monospace; height: ms(13); overflow-y: scroll; .description { font-size: ms(-1); padding-bottom: ms(-4); color: $neutral-500; } .option { padding: ms(-6); border-radius: ms(-8); color: $neutral-200; display: flex; flex-direction: row; align-items: center; gap: ms(-6); word-break: break-all; .check { display: flex; opacity: 0; &.selected { opacity: 1; color: $green-500 !important; } } &:hover { background: $neutral-700; .check { color: $neutral-500; opacity: 1; } } } } } } .input { border: 1px solid $neutral-200; border-radius: ms(-6); outline: none; background: transparent; font-size: ms(0); padding: ms(-6); } .actions { display: flex; flex-direction: row; gap: ms(-2); justify-content: flex-end; .save, .discard { font-size: ms(-1); padding: ms(-4) ms(-3); border-radius: ms(-8); cursor: pointer; } .save { color: $green-700; background: $green-200; &:hover { color: $green-900; background: $green-300; } } .discard { color: $neutral-700; background: $neutral-200; &:hover { color: $neutral-900; background: $neutral-300; } } } } } .alert { position: absolute; left: 0; top: 0; display: flex; flex-direction: row; justify-content: center; align-items: center; width: calc(100vw - #{ms(13)}); height: calc(100dvh); background: #{$neutral-900}dd; .dialog { display: flex; flex-direction: column; gap: ms(-2); background: $neutral-50; border-radius: ms(-6); width: ms(13); padding: ms(-2); .actions { display: flex; flex-direction: row; justify-content: flex-end; gap: ms(-2); .save, .discard { font-size: ms(-1); padding: ms(-4) ms(-3); border-radius: ms(-8); cursor: pointer; } .save { color: $green-700; background: $green-200; &:hover { color: $green-900; background: $green-300; } } .discard { color: $neutral-700; background: $neutral-200; &:hover { color: $neutral-900; background: $neutral-300; } } } } } } ================================================ FILE: symphony/client/index.tsx ================================================ import * as React from "react"; import { Suspense, useEffect, useRef, useState } from "react"; import * as ReactDOM from "react-dom/client"; import * as cx from "classnames"; import { encodeFunctionName, decodeFunctionName, getAssistantFromConnections, getModelIdFromAssistant, } from "../utils/functions"; import { Connection, Generation, Tool } from "../utils/types"; import "./index.scss"; import { parseISO, format } from "date-fns"; import { XIcon, ThreeBarsIcon, TrashIcon, GoalIcon, CheckIcon, } from "@primer/octicons-react"; import { pipe } from "fp-ts/lib/function"; import * as AR from "fp-ts/Array"; import * as O from "fp-ts/Option"; import { produce } from "immer"; import { Model } from "openai/resources"; const interfaceCache = {}; const getInterface = (name: string, type: string) => { if (name) { const hash = `${name}-${type}`; if (!interfaceCache[hash]) { interfaceCache[hash] = React.lazy(async () => { const module = await import( `../../interfaces/${encodeFunctionName(name)}.tsx` ); return { default: module[type] }; }); } return interfaceCache[hash]; } else { return
; } }; const EditGeneration = ({ generation, setIsEditing, socketRef }) => { const [content, setContent] = useState(generation.message.content); const [tools, setTools] = useState(generation.message.tool_calls); const contentRef = useRef(null); const argsRef = useRef(null); useEffect(() => { contentRef.current.style.height = "inherit"; const contentScrollHeight = contentRef.current.scrollHeight; contentRef.current.style.height = contentScrollHeight + "px"; if (argsRef.current) { argsRef.current.style.height = "inherit"; const argsScrollHeight = argsRef.current.scrollHeight; argsRef.current.style.height = argsScrollHeight + "px"; } const length = contentRef.current.value.length; contentRef.current.setSelectionRange(length, length); }, []); return (
{tools ? "Reasoning" : "Output"}