Spaces:
Running
Running
2nd update
Browse files- Dockerfile +22 -13
- README.md +1 -1
- node-backend/.env.production +1 -1
- node-backend/Dockerfile +0 -22
- node-backend/package.json +1 -1
- node-backend/src/server.ts +18 -0
- python-ai-service/QueueAndWorker/model_manager.py +15 -3
- react-frontend/dist/app-icon.png +0 -0
- react-frontend/dist/assets/{index-BKxufNR1.js → index-CS_Vi0C2.js} +1 -1
- react-frontend/dist/assets/{index-BKJNczi-.css → index-D12vuxSS.css} +1 -1
- react-frontend/dist/favicon.svg +0 -1
- react-frontend/dist/icons.svg +0 -24
- react-frontend/dist/index.html +3 -3
- react-frontend/dist/vite.config.js +50 -0
- requirements.txt +3 -1
Dockerfile
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
# ==========================================
|
| 2 |
# Production CPU Runtime Environment
|
| 3 |
# ==========================================
|
| 4 |
-
FROM python:3.
|
|
|
|
| 5 |
|
| 6 |
# Install system dependencies, Redis server, OpenBLAS for CPU matrix math, and Node.js
|
| 7 |
RUN apt-get update && apt-get install -y \
|
|
@@ -11,7 +12,7 @@ RUN apt-get update && apt-get install -y \
|
|
| 11 |
cmake \
|
| 12 |
pkg-config \
|
| 13 |
git \
|
| 14 |
-
libopenblas-dev \
|
| 15 |
redis-server \
|
| 16 |
&& curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
| 17 |
&& apt-get install -y nodejs \
|
|
@@ -26,7 +27,7 @@ RUN useradd -m -u 1000 user
|
|
| 26 |
WORKDIR /home/user/app
|
| 27 |
|
| 28 |
# Force llama-cpp-python to compile cleanly for CPU optimization
|
| 29 |
-
ENV CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS"
|
| 30 |
|
| 31 |
# Create cache directory for Hugging Face model downloads and set ownership
|
| 32 |
ENV HF_HOME=/home/user/app/.cache/huggingface
|
|
@@ -34,13 +35,19 @@ RUN mkdir -p $HF_HOME
|
|
| 34 |
|
| 35 |
# --- Setup Python Worker ---
|
| 36 |
COPY requirements.txt .
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
| 38 |
COPY python-ai-service/ ./python-ai-service
|
| 39 |
|
| 40 |
# --- Setup Node Backend ---
|
| 41 |
COPY node-backend/package*.json ./node-backend/
|
| 42 |
RUN cd node-backend && npm ci --only=production
|
|
|
|
| 43 |
COPY node-backend/ ./node-backend
|
|
|
|
|
|
|
| 44 |
|
| 45 |
# --- Setup Pre-built Frontend Static Files ---
|
| 46 |
# Copies directly from your react-frontend/dist folder
|
|
@@ -48,7 +55,7 @@ COPY react-frontend/dist ./node-backend/public
|
|
| 48 |
|
| 49 |
# Copy startup script
|
| 50 |
COPY start.sh .
|
| 51 |
-
RUN chmod +x start.sh
|
| 52 |
|
| 53 |
# Set environment variables
|
| 54 |
ENV PORT=7860
|
|
@@ -63,20 +70,22 @@ USER user
|
|
| 63 |
# Create a PM2 ecosystem file to launch Redis, Node Backend, and Python Worker
|
| 64 |
RUN echo 'module.exports = { \
|
| 65 |
apps: [ \
|
| 66 |
-
{ \
|
| 67 |
-
name: "redis-server", \
|
| 68 |
-
script: "redis-server", \
|
| 69 |
-
args: "--bind 127.0.0.1 --protected-mode no" \
|
| 70 |
-
}, \
|
| 71 |
{ \
|
| 72 |
name: "node-backend", \
|
| 73 |
-
script: "
|
|
|
|
|
|
|
| 74 |
env: { PORT: "7860", REDIS_URL: "redis://127.0.0.1:6379" } \
|
| 75 |
}, \
|
| 76 |
{ \
|
| 77 |
name: "python-worker", \
|
| 78 |
-
script: "python
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
} \
|
| 81 |
] \
|
| 82 |
};' > ecosystem.config.js
|
|
|
|
| 1 |
# ==========================================
|
| 2 |
# Production CPU Runtime Environment
|
| 3 |
# ==========================================
|
| 4 |
+
FROM python:3.12-slim
|
| 5 |
+
|
| 6 |
|
| 7 |
# Install system dependencies, Redis server, OpenBLAS for CPU matrix math, and Node.js
|
| 8 |
RUN apt-get update && apt-get install -y \
|
|
|
|
| 12 |
cmake \
|
| 13 |
pkg-config \
|
| 14 |
git \
|
| 15 |
+
# libopenblas-dev \
|
| 16 |
redis-server \
|
| 17 |
&& curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
| 18 |
&& apt-get install -y nodejs \
|
|
|
|
| 27 |
WORKDIR /home/user/app
|
| 28 |
|
| 29 |
# Force llama-cpp-python to compile cleanly for CPU optimization
|
| 30 |
+
# ENV CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS"
|
| 31 |
|
| 32 |
# Create cache directory for Hugging Face model downloads and set ownership
|
| 33 |
ENV HF_HOME=/home/user/app/.cache/huggingface
|
|
|
|
| 35 |
|
| 36 |
# --- Setup Python Worker ---
|
| 37 |
COPY requirements.txt .
|
| 38 |
+
|
| 39 |
+
ENV CMAKE_BUILD_PARALLEL_LEVEL=1
|
| 40 |
+
|
| 41 |
+
RUN pip install -vvv --no-cache-dir -r requirements.txt
|
| 42 |
COPY python-ai-service/ ./python-ai-service
|
| 43 |
|
| 44 |
# --- Setup Node Backend ---
|
| 45 |
COPY node-backend/package*.json ./node-backend/
|
| 46 |
RUN cd node-backend && npm ci --only=production
|
| 47 |
+
RUN cd node-backend && npm install typescript
|
| 48 |
COPY node-backend/ ./node-backend
|
| 49 |
+
RUN cd node-backend && npx --package typescript tsc
|
| 50 |
+
RUN cd node-backend && npm prune --production
|
| 51 |
|
| 52 |
# --- Setup Pre-built Frontend Static Files ---
|
| 53 |
# Copies directly from your react-frontend/dist folder
|
|
|
|
| 55 |
|
| 56 |
# Copy startup script
|
| 57 |
COPY start.sh .
|
| 58 |
+
RUN chmod +x /home/user/app/start.sh
|
| 59 |
|
| 60 |
# Set environment variables
|
| 61 |
ENV PORT=7860
|
|
|
|
| 70 |
# Create a PM2 ecosystem file to launch Redis, Node Backend, and Python Worker
|
| 71 |
RUN echo 'module.exports = { \
|
| 72 |
apps: [ \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
{ \
|
| 74 |
name: "node-backend", \
|
| 75 |
+
script: "npm", \
|
| 76 |
+
args: ["run", "start"], \
|
| 77 |
+
cwd: "node-backend", \
|
| 78 |
env: { PORT: "7860", REDIS_URL: "redis://127.0.0.1:6379" } \
|
| 79 |
}, \
|
| 80 |
{ \
|
| 81 |
name: "python-worker", \
|
| 82 |
+
script: "python", \
|
| 83 |
+
args: "main.py", \
|
| 84 |
+
cwd: "python-ai-service", \
|
| 85 |
+
env: { \
|
| 86 |
+
REDIS_URL: "redis://127.0.0.1:6379", \
|
| 87 |
+
PYTHONPATH: "/home/user/app/python-ai-service" \
|
| 88 |
+
} \
|
| 89 |
} \
|
| 90 |
] \
|
| 91 |
};' > ecosystem.config.js
|
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
emoji: 🚀
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: purple
|
|
|
|
| 1 |
---
|
| 2 |
+
title: AI coding assistant App
|
| 3 |
emoji: 🚀
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: purple
|
node-backend/.env.production
CHANGED
|
@@ -2,4 +2,4 @@ PORT=7860
|
|
| 2 |
|
| 3 |
REDIS_URL=redis://127.0.0.1:6379
|
| 4 |
|
| 5 |
-
FRONTEND_URL=https://subi333-
|
|
|
|
| 2 |
|
| 3 |
REDIS_URL=redis://127.0.0.1:6379
|
| 4 |
|
| 5 |
+
FRONTEND_URL=https://subi333-aicodingassistant.hf.space
|
node-backend/Dockerfile
DELETED
|
@@ -1,22 +0,0 @@
|
|
| 1 |
-
# Stage 1: Build stage
|
| 2 |
-
FROM node:20-alpine AS builder
|
| 3 |
-
WORKDIR /app
|
| 4 |
-
COPY package*.json ./
|
| 5 |
-
RUN npm install
|
| 6 |
-
COPY . .
|
| 7 |
-
# Compiles your TypeScript code into a clean JavaScript /dist folder
|
| 8 |
-
RUN npm run build
|
| 9 |
-
|
| 10 |
-
# Stage 2: Production execution stage
|
| 11 |
-
FROM node:20-alpine AS production
|
| 12 |
-
WORKDIR /app
|
| 13 |
-
ENV NODE_ENV=production
|
| 14 |
-
COPY package*.json ./
|
| 15 |
-
# Installs only lightweight production dependencies (no devDependencies)
|
| 16 |
-
RUN npm ci --only=production
|
| 17 |
-
# Copies only the compiled JavaScript files from the builder stage
|
| 18 |
-
COPY --from=builder /app/dist ./dist
|
| 19 |
-
# If you use raw assets like folders or views, copy them here too
|
| 20 |
-
|
| 21 |
-
EXPOSE 5000
|
| 22 |
-
CMD ["node", "dist/index.js"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
node-backend/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
"description": "",
|
| 5 |
"main": "index.js",
|
| 6 |
"scripts": {
|
| 7 |
-
"start": "node dist/
|
| 8 |
"dev": "powershell -Command \"[Console]::OutputEncoding=[System.Text.Encoding]::UTF8; nodemon --exec ts-node src/server.ts\"",
|
| 9 |
"test": "echo \"Error: no test specified\" && exit 1"
|
| 10 |
},
|
|
|
|
| 4 |
"description": "",
|
| 5 |
"main": "index.js",
|
| 6 |
"scripts": {
|
| 7 |
+
"start": "node dist/server.js",
|
| 8 |
"dev": "powershell -Command \"[Console]::OutputEncoding=[System.Text.Encoding]::UTF8; nodemon --exec ts-node src/server.ts\"",
|
| 9 |
"test": "echo \"Error: no test specified\" && exit 1"
|
| 10 |
},
|
node-backend/src/server.ts
CHANGED
|
@@ -102,6 +102,24 @@ if (process.env.NODE_ENV !== 'production') {
|
|
| 102 |
});
|
| 103 |
}
|
| 104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
app.use(cors(corsOptions));
|
| 106 |
app.options(/.*/, cors(corsOptions));
|
| 107 |
|
|
|
|
| 102 |
});
|
| 103 |
}
|
| 104 |
|
| 105 |
+
const publicPath = path.join(__dirname, "../public");
|
| 106 |
+
console.log("Public path:", publicPath);
|
| 107 |
+
console.log("Exists:", fs.existsSync(publicPath));
|
| 108 |
+
console.log("Index exists:", fs.existsSync(path.join(publicPath, "index.html")));
|
| 109 |
+
|
| 110 |
+
app.use(express.static(publicPath));
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
// Test route
|
| 114 |
+
app.get("/health", (req, res) => {
|
| 115 |
+
res.status(200).send("Backend is alive");
|
| 116 |
+
});
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
app.get("/*splat", (req, res) => {
|
| 120 |
+
res.sendFile(path.join(__dirname, "../public", "index.html"));
|
| 121 |
+
});
|
| 122 |
+
|
| 123 |
app.use(cors(corsOptions));
|
| 124 |
app.options(/.*/, cors(corsOptions));
|
| 125 |
|
python-ai-service/QueueAndWorker/model_manager.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
|
| 2 |
from llama_cpp import Llama
|
|
|
|
| 3 |
from pathlib import Path
|
| 4 |
import os
|
| 5 |
import logging
|
|
@@ -14,10 +15,21 @@ def load_model():
|
|
| 14 |
if _model is None:
|
| 15 |
logger.info("Qwen2.5-coder-3b-instruct model loading started")
|
| 16 |
try:
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
model_path_qwen =
|
|
|
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
_model = Llama(
|
| 22 |
model_path=model_path_qwen,
|
| 23 |
n_ctx=4096,
|
|
|
|
| 1 |
|
| 2 |
from llama_cpp import Llama
|
| 3 |
+
from huggingface_hub import hf_hub_download
|
| 4 |
from pathlib import Path
|
| 5 |
import os
|
| 6 |
import logging
|
|
|
|
| 15 |
if _model is None:
|
| 16 |
logger.info("Qwen2.5-coder-3b-instruct model loading started")
|
| 17 |
try:
|
| 18 |
+
# For dev
|
| 19 |
+
# BASE_DIR = Path(__file__).resolve().parent.parent
|
| 20 |
+
# model_path_qwen = BASE_DIR / "AiModels" / "CodingModel" / "qwen2.5-coder-3b-instruct-q4_k_m.gguf"
|
| 21 |
+
# model_path_qwen = os.environ.get('MODEL_PATH', str(model_path_qwen))
|
| 22 |
|
| 23 |
+
# For production
|
| 24 |
+
# Define a writeable cache path inside the user's home app directory
|
| 25 |
+
cache_dir = Path("/home/user/app/.cache/huggingface")
|
| 26 |
+
cache_dir.mkdir(parents=True, exist_ok=True)
|
| 27 |
+
|
| 28 |
+
model_path_qwen = hf_hub_download(
|
| 29 |
+
repo_id="bartowski/Qwen2.5-Coder-3B-Instruct-GGUF",
|
| 30 |
+
filename="Qwen2.5-Coder-3B-Instruct-Q4_K_M.gguf",
|
| 31 |
+
cache_dir=str(cache_dir) # <-- Force it to use the writeable folder
|
| 32 |
+
)
|
| 33 |
_model = Llama(
|
| 34 |
model_path=model_path_qwen,
|
| 35 |
n_ctx=4096,
|
react-frontend/dist/app-icon.png
ADDED
|
|
react-frontend/dist/assets/{index-BKxufNR1.js → index-CS_Vi0C2.js}
RENAMED
|
@@ -48,4 +48,4 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
|
|
| 48 |
`);return e===-1?``:t.stack.slice(e+1)})();try{if(!e.stack)e.stack=n;else if(n){let t=n.indexOf(`
|
| 49 |
`),r=t===-1?-1:n.indexOf(`
|
| 50 |
`,t+1),i=r===-1?``:n.slice(r+1);String(e.stack).endsWith(i)||(e.stack+=`
|
| 51 |
-
`+n)}}catch{}}throw e}}_request(e,t){typeof e==`string`?(t||={},t.url=e):t=e||{},t=H_(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&Sv.assertOptions(n,{silentJSONParsing:Cv.transitional(Cv.boolean),forcedJSONParsing:Cv.transitional(Cv.boolean),clarifyTimeoutError:Cv.transitional(Cv.boolean),legacyInterceptorReqResOrdering:Cv.transitional(Cv.boolean),advertiseZstdAcceptEncoding:Cv.transitional(Cv.boolean),validateStatusUndefinedResolves:Cv.transitional(Cv.boolean)},!1),r!=null&&(Z.isFunction(r)?t.paramsSerializer={serialize:r}:Sv.assertOptions(r,{encode:Cv.function,serialize:Cv.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?t.allowAbsoluteUrls=!0:t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),Sv.assertOptions(t,{baseUrl:Cv.spelling(`baseURL`),withXsrfToken:Cv.spelling(`withXSRFToken`)},!0),t.method=(t.method||this.defaults.method||`get`).toLowerCase();let a=i&&Z.merge(i.common,i[t.method]);i&&Z.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`query`,`common`],e=>{delete i[e]}),t.headers=Vg.concat(a,i);let o=[],s=!0;this.interceptors.request.forEach(function(e){if(typeof e.runWhen==`function`&&e.runWhen(t)===!1)return;s&&=e.synchronous;let n=t.transitional||r_;n&&n.legacyInterceptorReqResOrdering?o.unshift(e.fulfilled,e.rejected):o.push(e.fulfilled,e.rejected)});let c=[];this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,u=0,d;if(!s){let e=[vv.bind(this),void 0];for(e.unshift(...o),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=o.length;let f=t;for(;u<d;){let e=o[u++],t=o[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=vv.call(this,f)}catch(e){return Promise.reject(e)}for(u=0,d=c.length;u<d;)l=l.then(c[u++],c[u++]);return l}getUri(e){return e=H_(this.defaults,e),t_(B_(e.baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}};Z.forEach([`delete`,`get`,`head`,`options`],function(e){wv.prototype[e]=function(t,n){return this.request(H_(n||{},{method:e,url:t,data:n&&Z.hasOwnProp(n,`data`)?n.data:void 0}))}}),Z.forEach([`post`,`put`,`patch`,`query`],function(e){function t(t){return function(n,r,i){return this.request(H_(i||{},{method:e,headers:t?{"Content-Type":`multipart/form-data`}:{},url:n,data:r}))}}wv.prototype[e]=t(),e!==`query`&&(wv.prototype[e+`Form`]=t(!0))});var Tv=class e{constructor(e){if(typeof e!=`function`)throw TypeError(`executor must be a function.`);let t;this.promise=new Promise(function(e){t=e});let n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-->0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t,r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new C_(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};function Ev(e){return function(t){return e.apply(null,t)}}function Dv(e){return Z.isObject(e)&&e.isAxiosError===!0}var Ov={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ov).forEach(([e,t])=>{Ov[t]=e});function kv(e){let t=new wv(e),n=Gm(wv.prototype.request,t);return Z.extend(n,wv.prototype,t,{allOwnKeys:!0}),Z.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return kv(H_(e,t))},n}var Av=kv(b_);Av.Axios=wv,Av.CanceledError=C_,Av.CancelToken=Tv,Av.isCancel=S_,Av.VERSION=nv,Av.toFormData=Xg,Av.AxiosError=Q,Av.Cancel=Av.CanceledError,Av.all=function(e){return Promise.all(e)},Av.spread=Ev,Av.isAxiosError=Dv,Av.mergeConfig=H_,Av.AxiosHeaders=Vg,Av.formToJSON=e=>__(Z.isHTMLForm(e)?new FormData(e):e),Av.getAdapter=gv.getAdapter,Av.HttpStatusCode=Ov,Av.default=Av;var jv=Av.create({baseURL:`/api/v1`,timeout:3e4}),Mv={codeBlockContainer:`_codeBlockContainer_l4365_3`,copyCodeBtn:`_copyCodeBtn_l4365_21`,customPre:`_customPre_l4365_81`};function Nv({children:e}){let[t,n]=(0,I.useState)(!1);return(0,B.jsxs)(`div`,{className:Mv.codeBlockContainer,children:[(0,B.jsx)(`button`,{onClick:async()=>{try{let t=e=>e?typeof e==`string`?e:typeof e==`number`?e.toString():Array.isArray(e)?e.map(t).join(``):e.props&&e.props.children?t(e.props.children):``:``,r=t(e);await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!1),2e3)}catch(e){console.error(`Failed to copy text: `,e)}},className:Mv.copyCodeBtn,children:t?`Copied!`:`Copy`}),(0,B.jsx)(`pre`,{className:Mv.customPre,children:e})]})}var Pv={spinnerContainer:`_spinnerContainer_1y0ia_1`,spinner:`_spinner_1y0ia_1`,tick:`_tick_1y0ia_29`,fadePulse:`_fadePulse_1y0ia_1`};function Fv({size:e=40}){return(0,B.jsx)(`div`,{className:Pv.spinnerContainer,style:{"--spinner-size":`${e}px`},children:(0,B.jsx)(`div`,{className:Pv.spinner,children:Array.from({length:12}).map((e,t)=>(0,B.jsx)(`div`,{className:Pv.tick,style:{"--tick-index":t}},t))})})}var $={appWrapper:`_appWrapper_1u7vo_1`,sidebar:`_sidebar_1u7vo_23`,sidebarClosed:`_sidebarClosed_1u7vo_45`,sidebarHeader:`_sidebarHeader_1u7vo_57`,newChatBtn:`_newChatBtn_1u7vo_73`,toggleCollapseBtn:`_toggleCollapseBtn_1u7vo_113`,menuExpandBtn:`_menuExpandBtn_1u7vo_113`,historyList:`_historyList_1u7vo_143`,historySectionTitle:`_historySectionTitle_1u7vo_155`,historyItem:`_historyItem_1u7vo_169`,chatTitle:`_chatTitle_1u7vo_199`,mainCanvas:`_mainCanvas_1u7vo_213`,topBar:`_topBar_1u7vo_231`,modelBadge:`_modelBadge_1u7vo_247`,scrollContainer:`_scrollContainer_1u7vo_261`,contentConstrain:`_contentConstrain_1u7vo_273`,messageRow:`_messageRow_1u7vo_285`,fadeIn:`_fadeIn_1u7vo_1`,identityGroup:`_identityGroup_1u7vo_311`,avatarIcon:`_avatarIcon_1u7vo_323`,userAvatar:`_userAvatar_1u7vo_345`,assistantAvatar:`_assistantAvatar_1u7vo_355`,senderLabel:`_senderLabel_1u7vo_365`,bubblePayload:`_bubblePayload_1u7vo_375`,typingIndicator:`_typingIndicator_1u7vo_399`,bounce:`_bounce_1u7vo_1`,dockFooter:`_dockFooter_1u7vo_449`,dockConstrain:`_dockConstrain_1u7vo_459`,inputFormBox:`_inputFormBox_1u7vo_475`,spinnerCont:`_spinnerCont_1u7vo_495`,textField:`_textField_1u7vo_503`,actionSendBtn:`_actionSendBtn_1u7vo_539`,disclaimerText:`_disclaimerText_1u7vo_587`},Iv=()=>{let[e,t]=(0,I.useState)([]),[n,r]=(0,I.useState)([{id:crypto.randomUUID(),sender:`AI coding assistant`,text:`Hello! I am your AI coding assistant. How can I help you build today?`}]),[i,a]=(0,I.useState)(``),[o,s]=(0,I.useState)(!1),[c,l]=(0,I.useState)(!0),[u,d]=(0,I.useState)(!1),f=(0,I.useRef)(null),p=(0,I.useRef)(``),m=(0,I.useRef)(``),h=(0,I.useRef)(!0),g=(0,I.useRef)(null),{anonId:_}=gn(),v=e=>{let n={id:crypto.randomUUID(),sender:`AI coding assistant`,text:e.detail.result};console.log(`curSessionIdRef.current - `,p.current),console.log(`event.detail.msgSession - `,e.detail.msgSession),setTimeout(()=>{p.current===e.detail.msgSession&&r(e=>[...e,n])},1200),t(e=>e.map(e=>e.id===m.current?{...e,sessionMsg:[...e.sessionMsg,n]}:e)),d(!1)};(0,I.useEffect)(()=>{let e=g.current;if(!e)return;e.style.height=`auto`;let t=parseFloat(getComputedStyle(e).lineHeight)*6;e.style.height=Math.min(e.scrollHeight,t)+`px`,e.style.overflowY=e.scrollHeight>200?`auto`:`hidden`},[i]),(0,I.useEffect)(()=>(window.addEventListener(`gptChatRes`,v),f.current?.scrollIntoView({behavior:`smooth`}),()=>{window.removeEventListener(`gptChatRes`,v)}),[n,o]);let y=()=>{d(!1),h.current=!0,r([{id:crypto.randomUUID(),sender:`AI coding assistant`,text:`Hello! I am your AI assistant. How can I help you build today?`}])},b=t=>{let n=e.find(e=>e.id===t);n&&(r(n.sessionMsg),p.current=t)},x=async e=>{if(e.preventDefault(),!i.trim())return;d(!0);let n={id:crypto.randomUUID(),sender:`user`,text:i};h.current?(p.current=crypto.randomUUID(),t(e=>[...e,{id:p.current,title:i.slice(0,30)+` ...`,sessionMsg:[n]}]),h.current=!1):t(e=>e.map(e=>e.id===p.current?{...e,sessionMsg:[...e.sessionMsg,n]}:e)),m.current=p.current,r(e=>[...e,n]),a(``),s(!0);let o=await jv.post(`/users/aichat`,{aiInput:n.text,msgSession:p.current},{headers:{"x-anonuser-id":_}});s(!1),o?.status===200?console.log(`Your propmt has been submitted, It may take a while to get response.`):console.log(`Error submitting prompt, Please try again later!`)};return(0,B.jsxs)(`div`,{className:$.appWrapper,children:[(0,B.jsxs)(`aside`,{className:`${$.sidebar} ${c?``:$.sidebarClosed}`,children:[(0,B.jsxs)(`div`,{className:$.sidebarHeader,children:[(0,B.jsxs)(`button`,{className:$.newChatBtn,onClick:y,children:[(0,B.jsx)(`span`,{children:`+`}),` New chat`]}),(0,B.jsx)(`button`,{onClick:()=>l(!1),className:$.toggleCollapseBtn,children:`◂`})]}),(0,B.jsxs)(`nav`,{className:$.historyList,children:[(0,B.jsx)(`div`,{className:$.historySectionTitle,children:`Recent Conversations`}),e.map(e=>(0,B.jsxs)(`div`,{className:$.historyItem,onClick:()=>b(e.id),children:[(0,B.jsx)(`span`,{className:$.chatIcon,children:`💬`}),(0,B.jsx)(`span`,{className:$.chatTitle,children:e.title})]},e.id))]})]}),(0,B.jsxs)(`main`,{className:$.mainCanvas,children:[(0,B.jsxs)(`header`,{className:$.topBar,children:[!c&&(0,B.jsx)(`button`,{onClick:()=>l(!0),className:$.menuExpandBtn,children:`▸`}),(0,B.jsx)(`div`,{className:$.modelBadge,children:`Qwen2.5 coder ✨`})]}),(0,B.jsx)(`div`,{className:$.scrollContainer,children:(0,B.jsxs)(`div`,{className:$.contentConstrain,children:[n.map(e=>(0,B.jsxs)(`div`,{className:`${$.messageRow} ${e.sender===`user`?$.userAlign:$.assistantAlign}`,children:[(0,B.jsx)(`div`,{className:`${$.avatarIcon} ${e.sender===`user`?$.userAvatar:$.assistantAvatar}`,children:e.sender===`user`?`U`:`AI`}),(0,B.jsxs)(`div`,{className:$.messageContentBlock,children:[(0,B.jsx)(`div`,{className:$.senderLabel,children:e.sender===`user`?`You`:`AI Chat`}),(0,B.jsx)(`div`,{className:$.bubblePayload,children:(0,B.jsx)(`div`,{className:`prose dark:prose-invert max-w-none`,children:(0,B.jsx)(il,{remarkPlugins:[of],rehypePlugins:[Um],components:{a:({...e})=>(0,B.jsx)(`a`,{...e,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-400 underline hover:text-blue-300 cursor-pointer`}),pre:({children:e})=>(0,B.jsx)(Nv,{children:e})},children:e.text})})})]})]},e.id)),o&&(0,B.jsxs)(`div`,{className:`${$.messageRow} ${$.assistantAlign}`,children:[(0,B.jsx)(`div`,{className:`${$.avatarIcon} ${$.assistantAvatar}`,children:`AI`}),(0,B.jsxs)(`div`,{className:$.messageContentBlock,children:[(0,B.jsx)(`div`,{className:$.senderLabel,children:`AI Chat`}),(0,B.jsxs)(`div`,{className:$.typingIndicator,children:[(0,B.jsx)(`span`,{}),(0,B.jsx)(`span`,{}),(0,B.jsx)(`span`,{})]})]})]}),(0,B.jsx)(`div`,{ref:f})]})}),u&&(0,B.jsx)(`div`,{className:$.spinnerCont,children:(0,B.jsx)(Fv,{})}),(0,B.jsx)(`footer`,{className:$.dockFooter,children:(0,B.jsxs)(`div`,{className:$.dockConstrain,children:[(0,B.jsxs)(`form`,{onSubmit:x,className:$.inputFormBox,children:[(0,B.jsx)(`textarea`,{disabled:u,ref:g,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),x({preventDefault:()=>{}}))},placeholder:`Message AI Chat...`,rows:1,className:$.textField,wrap:`soft`}),(0,B.jsx)(`button`,{type:`submit`,disabled:!i.trim(),className:$.actionSendBtn,children:(0,B.jsx)(Dn,{})})]}),(0,B.jsx)(`p`,{className:$.disclaimerText,children:`AI Chat may make mistakes.`})]})})]})]})};function Lv(){return(0,B.jsx)(Iv,{})}(0,L.createRoot)(document.getElementById(`root`)).render((0,B.jsxs)(hn,{children:[(0,B.jsx)(_n,{}),(0,B.jsx)(Lv,{})]}));
|
|
|
|
| 48 |
`);return e===-1?``:t.stack.slice(e+1)})();try{if(!e.stack)e.stack=n;else if(n){let t=n.indexOf(`
|
| 49 |
`),r=t===-1?-1:n.indexOf(`
|
| 50 |
`,t+1),i=r===-1?``:n.slice(r+1);String(e.stack).endsWith(i)||(e.stack+=`
|
| 51 |
+
`+n)}}catch{}}throw e}}_request(e,t){typeof e==`string`?(t||={},t.url=e):t=e||{},t=H_(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&Sv.assertOptions(n,{silentJSONParsing:Cv.transitional(Cv.boolean),forcedJSONParsing:Cv.transitional(Cv.boolean),clarifyTimeoutError:Cv.transitional(Cv.boolean),legacyInterceptorReqResOrdering:Cv.transitional(Cv.boolean),advertiseZstdAcceptEncoding:Cv.transitional(Cv.boolean),validateStatusUndefinedResolves:Cv.transitional(Cv.boolean)},!1),r!=null&&(Z.isFunction(r)?t.paramsSerializer={serialize:r}:Sv.assertOptions(r,{encode:Cv.function,serialize:Cv.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?t.allowAbsoluteUrls=!0:t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),Sv.assertOptions(t,{baseUrl:Cv.spelling(`baseURL`),withXsrfToken:Cv.spelling(`withXSRFToken`)},!0),t.method=(t.method||this.defaults.method||`get`).toLowerCase();let a=i&&Z.merge(i.common,i[t.method]);i&&Z.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`query`,`common`],e=>{delete i[e]}),t.headers=Vg.concat(a,i);let o=[],s=!0;this.interceptors.request.forEach(function(e){if(typeof e.runWhen==`function`&&e.runWhen(t)===!1)return;s&&=e.synchronous;let n=t.transitional||r_;n&&n.legacyInterceptorReqResOrdering?o.unshift(e.fulfilled,e.rejected):o.push(e.fulfilled,e.rejected)});let c=[];this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,u=0,d;if(!s){let e=[vv.bind(this),void 0];for(e.unshift(...o),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=o.length;let f=t;for(;u<d;){let e=o[u++],t=o[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=vv.call(this,f)}catch(e){return Promise.reject(e)}for(u=0,d=c.length;u<d;)l=l.then(c[u++],c[u++]);return l}getUri(e){return e=H_(this.defaults,e),t_(B_(e.baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}};Z.forEach([`delete`,`get`,`head`,`options`],function(e){wv.prototype[e]=function(t,n){return this.request(H_(n||{},{method:e,url:t,data:n&&Z.hasOwnProp(n,`data`)?n.data:void 0}))}}),Z.forEach([`post`,`put`,`patch`,`query`],function(e){function t(t){return function(n,r,i){return this.request(H_(i||{},{method:e,headers:t?{"Content-Type":`multipart/form-data`}:{},url:n,data:r}))}}wv.prototype[e]=t(),e!==`query`&&(wv.prototype[e+`Form`]=t(!0))});var Tv=class e{constructor(e){if(typeof e!=`function`)throw TypeError(`executor must be a function.`);let t;this.promise=new Promise(function(e){t=e});let n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-->0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t,r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new C_(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};function Ev(e){return function(t){return e.apply(null,t)}}function Dv(e){return Z.isObject(e)&&e.isAxiosError===!0}var Ov={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ov).forEach(([e,t])=>{Ov[t]=e});function kv(e){let t=new wv(e),n=Gm(wv.prototype.request,t);return Z.extend(n,wv.prototype,t,{allOwnKeys:!0}),Z.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return kv(H_(e,t))},n}var Av=kv(b_);Av.Axios=wv,Av.CanceledError=C_,Av.CancelToken=Tv,Av.isCancel=S_,Av.VERSION=nv,Av.toFormData=Xg,Av.AxiosError=Q,Av.Cancel=Av.CanceledError,Av.all=function(e){return Promise.all(e)},Av.spread=Ev,Av.isAxiosError=Dv,Av.mergeConfig=H_,Av.AxiosHeaders=Vg,Av.formToJSON=e=>__(Z.isHTMLForm(e)?new FormData(e):e),Av.getAdapter=gv.getAdapter,Av.HttpStatusCode=Ov,Av.default=Av;var jv=Av.create({baseURL:`/api/v1`,timeout:3e4}),Mv={codeBlockContainer:`_codeBlockContainer_l4365_3`,copyCodeBtn:`_copyCodeBtn_l4365_21`,customPre:`_customPre_l4365_81`};function Nv({children:e}){let[t,n]=(0,I.useState)(!1);return(0,B.jsxs)(`div`,{className:Mv.codeBlockContainer,children:[(0,B.jsx)(`button`,{onClick:async()=>{try{let t=e=>e?typeof e==`string`?e:typeof e==`number`?e.toString():Array.isArray(e)?e.map(t).join(``):e.props&&e.props.children?t(e.props.children):``:``,r=t(e);await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!1),2e3)}catch(e){console.error(`Failed to copy text: `,e)}},className:Mv.copyCodeBtn,children:t?`Copied!`:`Copy`}),(0,B.jsx)(`pre`,{className:Mv.customPre,children:e})]})}var Pv={spinnerContainer:`_spinnerContainer_1y0ia_1`,spinner:`_spinner_1y0ia_1`,tick:`_tick_1y0ia_29`,fadePulse:`_fadePulse_1y0ia_1`};function Fv({size:e=40}){return(0,B.jsx)(`div`,{className:Pv.spinnerContainer,style:{"--spinner-size":`${e}px`},children:(0,B.jsx)(`div`,{className:Pv.spinner,children:Array.from({length:12}).map((e,t)=>(0,B.jsx)(`div`,{className:Pv.tick,style:{"--tick-index":t}},t))})})}var $={appWrapper:`_appWrapper_1gms4_1`,sidebar:`_sidebar_1gms4_31`,sidebarClosed:`_sidebarClosed_1gms4_53`,sidebarHeader:`_sidebarHeader_1gms4_65`,newChatBtn:`_newChatBtn_1gms4_81`,toggleCollapseBtn:`_toggleCollapseBtn_1gms4_121`,menuExpandBtn:`_menuExpandBtn_1gms4_121`,historyList:`_historyList_1gms4_151`,historySectionTitle:`_historySectionTitle_1gms4_163`,historyItem:`_historyItem_1gms4_177`,chatTitle:`_chatTitle_1gms4_207`,mainCanvas:`_mainCanvas_1gms4_221`,topBar:`_topBar_1gms4_239`,modelBadge:`_modelBadge_1gms4_255`,scrollContainer:`_scrollContainer_1gms4_269`,contentConstrain:`_contentConstrain_1gms4_281`,messageRow:`_messageRow_1gms4_293`,fadeIn:`_fadeIn_1gms4_1`,identityGroup:`_identityGroup_1gms4_319`,avatarIcon:`_avatarIcon_1gms4_331`,userAvatar:`_userAvatar_1gms4_353`,assistantAvatar:`_assistantAvatar_1gms4_363`,senderLabel:`_senderLabel_1gms4_373`,bubblePayload:`_bubblePayload_1gms4_383`,typingIndicator:`_typingIndicator_1gms4_407`,bounce:`_bounce_1gms4_1`,dockFooter:`_dockFooter_1gms4_457`,dockConstrain:`_dockConstrain_1gms4_467`,inputFormBox:`_inputFormBox_1gms4_483`,spinnerCont:`_spinnerCont_1gms4_503`,textField:`_textField_1gms4_511`,actionSendBtn:`_actionSendBtn_1gms4_547`,disclaimerText:`_disclaimerText_1gms4_595`},Iv=()=>{let[e,t]=(0,I.useState)([]),[n,r]=(0,I.useState)([{id:crypto.randomUUID(),sender:`AI coding assistant`,text:`Hello! I am your AI coding assistant. How can I help you build today?`}]),[i,a]=(0,I.useState)(``),[o,s]=(0,I.useState)(!1),[c,l]=(0,I.useState)(!0),[u,d]=(0,I.useState)(!1),f=(0,I.useRef)(null),p=(0,I.useRef)(``),m=(0,I.useRef)(``),h=(0,I.useRef)(!0),g=(0,I.useRef)(null),{anonId:_}=gn(),v=e=>{let n={id:crypto.randomUUID(),sender:`AI coding assistant`,text:e.detail.result};console.log(`curSessionIdRef.current - `,p.current),console.log(`event.detail.msgSession - `,e.detail.msgSession),setTimeout(()=>{p.current===e.detail.msgSession&&r(e=>[...e,n])},1200),t(e=>e.map(e=>e.id===m.current?{...e,sessionMsg:[...e.sessionMsg,n]}:e)),d(!1)};(0,I.useEffect)(()=>{let e=g.current;if(!e)return;e.style.height=`auto`;let t=parseFloat(getComputedStyle(e).lineHeight)*6;e.style.height=Math.min(e.scrollHeight,t)+`px`,e.style.overflowY=e.scrollHeight>200?`auto`:`hidden`},[i]),(0,I.useEffect)(()=>(window.addEventListener(`gptChatRes`,v),f.current?.scrollIntoView({behavior:`smooth`}),()=>{window.removeEventListener(`gptChatRes`,v)}),[n,o]);let y=()=>{d(!1),h.current=!0,r([{id:crypto.randomUUID(),sender:`AI coding assistant`,text:`Hello! I am your AI assistant. How can I help you build today?`}])},b=t=>{let n=e.find(e=>e.id===t);n&&(r(n.sessionMsg),p.current=t)},x=async e=>{if(e.preventDefault(),!i.trim())return;d(!0);let n={id:crypto.randomUUID(),sender:`user`,text:i};h.current?(p.current=crypto.randomUUID(),t(e=>[...e,{id:p.current,title:i.slice(0,30)+` ...`,sessionMsg:[n]}]),h.current=!1):t(e=>e.map(e=>e.id===p.current?{...e,sessionMsg:[...e.sessionMsg,n]}:e)),m.current=p.current,r(e=>[...e,n]),a(``),s(!0);let o=await jv.post(`/users/aichat`,{aiInput:n.text,msgSession:p.current},{headers:{"x-anonuser-id":_}});s(!1),o?.status===200?console.log(`Your propmt has been submitted, It may take a while to get response.`):console.log(`Error submitting prompt, Please try again later!`)};return(0,B.jsxs)(`div`,{className:$.appWrapper,children:[(0,B.jsxs)(`aside`,{className:`${$.sidebar} ${c?``:$.sidebarClosed}`,children:[(0,B.jsxs)(`div`,{className:$.sidebarHeader,children:[(0,B.jsxs)(`button`,{className:$.newChatBtn,onClick:y,children:[(0,B.jsx)(`span`,{children:`+`}),` New chat`]}),(0,B.jsx)(`button`,{onClick:()=>l(!1),className:$.toggleCollapseBtn,children:`◂`})]}),(0,B.jsxs)(`nav`,{className:$.historyList,children:[(0,B.jsx)(`div`,{className:$.historySectionTitle,children:`Recent Conversations`}),e.map(e=>(0,B.jsxs)(`div`,{className:$.historyItem,onClick:()=>b(e.id),children:[(0,B.jsx)(`span`,{className:$.chatIcon,children:`💬`}),(0,B.jsx)(`span`,{className:$.chatTitle,children:e.title})]},e.id))]})]}),(0,B.jsxs)(`main`,{className:$.mainCanvas,children:[(0,B.jsxs)(`header`,{className:$.topBar,children:[!c&&(0,B.jsx)(`button`,{onClick:()=>l(!0),className:$.menuExpandBtn,children:`▸`}),(0,B.jsx)(`div`,{className:$.modelBadge,children:`Qwen2.5 coder ✨`})]}),(0,B.jsx)(`div`,{className:$.scrollContainer,children:(0,B.jsxs)(`div`,{className:$.contentConstrain,children:[n.map(e=>(0,B.jsxs)(`div`,{className:`${$.messageRow} ${e.sender===`user`?$.userAlign:$.assistantAlign}`,children:[(0,B.jsx)(`div`,{className:`${$.avatarIcon} ${e.sender===`user`?$.userAvatar:$.assistantAvatar}`,children:e.sender===`user`?`U`:`AI`}),(0,B.jsxs)(`div`,{className:$.messageContentBlock,children:[(0,B.jsx)(`div`,{className:$.senderLabel,children:e.sender===`user`?`You`:`AI Chat`}),(0,B.jsx)(`div`,{className:$.bubblePayload,children:(0,B.jsx)(`div`,{className:`prose dark:prose-invert max-w-none`,children:(0,B.jsx)(il,{remarkPlugins:[of],rehypePlugins:[Um],components:{a:({...e})=>(0,B.jsx)(`a`,{...e,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-400 underline hover:text-blue-300 cursor-pointer`}),pre:({children:e})=>(0,B.jsx)(Nv,{children:e})},children:e.text})})})]})]},e.id)),o&&(0,B.jsxs)(`div`,{className:`${$.messageRow} ${$.assistantAlign}`,children:[(0,B.jsx)(`div`,{className:`${$.avatarIcon} ${$.assistantAvatar}`,children:`AI`}),(0,B.jsxs)(`div`,{className:$.messageContentBlock,children:[(0,B.jsx)(`div`,{className:$.senderLabel,children:`AI Chat`}),(0,B.jsxs)(`div`,{className:$.typingIndicator,children:[(0,B.jsx)(`span`,{}),(0,B.jsx)(`span`,{}),(0,B.jsx)(`span`,{})]})]})]}),(0,B.jsx)(`div`,{ref:f})]})}),u&&(0,B.jsx)(`div`,{className:$.spinnerCont,children:(0,B.jsx)(Fv,{})}),(0,B.jsx)(`footer`,{className:$.dockFooter,children:(0,B.jsxs)(`div`,{className:$.dockConstrain,children:[(0,B.jsxs)(`form`,{onSubmit:x,className:$.inputFormBox,children:[(0,B.jsx)(`textarea`,{disabled:u,ref:g,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),x({preventDefault:()=>{}}))},placeholder:`Message AI Chat...`,rows:1,className:$.textField,wrap:`soft`}),(0,B.jsx)(`button`,{type:`submit`,disabled:!i.trim(),className:$.actionSendBtn,children:(0,B.jsx)(Dn,{})})]}),(0,B.jsx)(`p`,{className:$.disclaimerText,children:`AI Chat may make mistakes.`})]})})]})]})};function Lv(){return(0,B.jsx)(Iv,{})}(0,L.createRoot)(document.getElementById(`root`)).render((0,B.jsxs)(hn,{children:[(0,B.jsx)(_n,{}),(0,B.jsx)(Lv,{})]}));
|
react-frontend/dist/assets/{index-BKJNczi-.css → index-D12vuxSS.css}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
html,body,#root{background-color:#212121;width:100vw;height:100vh;margin:0;padding:0}body{display:block}pre code.hljs{padding:1em;display:block;overflow-x:auto}code.hljs{padding:3px 5px}.hljs{color:#c9d1d9;background:#0d1117}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#ff7b72}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#d2a8ff}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-variable,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id{color:#79c0ff}.hljs-regexp,.hljs-string,.hljs-meta .hljs-string{color:#a5d6ff}.hljs-built_in,.hljs-symbol{color:#ffa657}.hljs-comment,.hljs-code,.hljs-formula{color:#8b949e}.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo{color:#7ee787}.hljs-subst{color:#c9d1d9}.hljs-section{color:#1f6feb;font-weight:700}.hljs-bullet{color:#f2cc60}.hljs-emphasis{color:#c9d1d9;font-style:italic}.hljs-strong{color:#c9d1d9;font-weight:700}.hljs-addition{color:#aff5b4;background-color:#033a16}.hljs-deletion{color:#ffdcd7;background-color:#67060c}._codeBlockContainer_l4365_3{background-color:#0f172a;border-radius:8px;margin:1rem 0;position:relative;overflow:hidden}._copyCodeBtn_l4365_21{z-index:10;color:#94a3b8;cursor:pointer;opacity:0;background-color:#1e293b;border:1px solid #334155;border-radius:4px;padding:4px 10px;font-family:sans-serif;font-size:12px;font-weight:500;transition:opacity .2s,background-color .2s,color .2s;position:absolute;top:12px;right:12px}._codeBlockContainer_l4365_3:hover ._copyCodeBtn_l4365_21{opacity:1}._copyCodeBtn_l4365_21:hover{color:#fff;background-color:#475569}._customPre_l4365_81{margin:0;padding:16px;overflow-x:auto;background:0 0!important}._spinnerContainer_1y0ia_1{width:var(--spinner-size);height:var(--spinner-size);justify-content:center;align-items:center;display:inline-flex}._spinner_1y0ia_1{width:100%;height:100%;position:relative}._tick_1y0ia_29{transform-origin:50% 200%;width:2px;height:25%;transform:translateX(-50%) rotate(calc(var(--tick-index) * 30deg));animation:1.2s linear infinite _fadePulse_1y0ia_1;animation-delay:calc(var(--tick-index) * -.1s);background-color:#6366f1;border-radius:2px;position:absolute;top:0;left:50%}@keyframes _fadePulse_1y0ia_1{0%{opacity:1}to{opacity:.15}}.
|
|
|
|
| 1 |
+
html,body,#root{background-color:#212121;width:100vw;height:100vh;margin:0;padding:0}body{display:block}pre code.hljs{padding:1em;display:block;overflow-x:auto}code.hljs{padding:3px 5px}.hljs{color:#c9d1d9;background:#0d1117}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#ff7b72}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#d2a8ff}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-variable,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id{color:#79c0ff}.hljs-regexp,.hljs-string,.hljs-meta .hljs-string{color:#a5d6ff}.hljs-built_in,.hljs-symbol{color:#ffa657}.hljs-comment,.hljs-code,.hljs-formula{color:#8b949e}.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo{color:#7ee787}.hljs-subst{color:#c9d1d9}.hljs-section{color:#1f6feb;font-weight:700}.hljs-bullet{color:#f2cc60}.hljs-emphasis{color:#c9d1d9;font-style:italic}.hljs-strong{color:#c9d1d9;font-weight:700}.hljs-addition{color:#aff5b4;background-color:#033a16}.hljs-deletion{color:#ffdcd7;background-color:#67060c}._codeBlockContainer_l4365_3{background-color:#0f172a;border-radius:8px;margin:1rem 0;position:relative;overflow:hidden}._copyCodeBtn_l4365_21{z-index:10;color:#94a3b8;cursor:pointer;opacity:0;background-color:#1e293b;border:1px solid #334155;border-radius:4px;padding:4px 10px;font-family:sans-serif;font-size:12px;font-weight:500;transition:opacity .2s,background-color .2s,color .2s;position:absolute;top:12px;right:12px}._codeBlockContainer_l4365_3:hover ._copyCodeBtn_l4365_21{opacity:1}._copyCodeBtn_l4365_21:hover{color:#fff;background-color:#475569}._customPre_l4365_81{margin:0;padding:16px;overflow-x:auto;background:0 0!important}._spinnerContainer_1y0ia_1{width:var(--spinner-size);height:var(--spinner-size);justify-content:center;align-items:center;display:inline-flex}._spinner_1y0ia_1{width:100%;height:100%;position:relative}._tick_1y0ia_29{transform-origin:50% 200%;width:2px;height:25%;transform:translateX(-50%) rotate(calc(var(--tick-index) * 30deg));animation:1.2s linear infinite _fadePulse_1y0ia_1;animation-delay:calc(var(--tick-index) * -.1s);background-color:#6366f1;border-radius:2px;position:absolute;top:0;left:50%}@keyframes _fadePulse_1y0ia_1{0%{opacity:1}to{opacity:.15}}._appWrapper_1gms4_1{color:#e3e3e3;background-color:#212121;width:100vw;height:100vh;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;display:flex;overflow:hidden}._sidebar_1gms4_31{background-color:#171717;border-right:1px solid #2f2f2f;flex-direction:column;flex-shrink:0;width:260px;height:100%;transition:transform .25s cubic-bezier(.4,0,.2,1),width .25s;display:flex}._sidebarClosed_1gms4_53{border-right:none;width:0;transform:translate(-260px)}._sidebarHeader_1gms4_65{justify-content:space-between;align-items:center;gap:8px;padding:12px;display:flex}._newChatBtn_1gms4_81{color:#fff;cursor:pointer;text-align:left;background:0 0;border:1px solid #424242;border-radius:6px;flex:1;align-items:center;gap:8px;padding:10px 14px;font-size:14px;transition:background .2s;display:flex}._newChatBtn_1gms4_81:hover{background-color:#2a2a2a}._toggleCollapseBtn_1gms4_121,._menuExpandBtn_1gms4_121{color:#b4b4b4;cursor:pointer;background:0 0;border:none;border-radius:6px;padding:8px;font-size:18px}._toggleCollapseBtn_1gms4_121:hover,._menuExpandBtn_1gms4_121:hover{color:#fff;background-color:#2a2a2a}._historyList_1gms4_151{flex:1;padding:0 12px;overflow-y:auto}._historySectionTitle_1gms4_163{color:#8e8e8e;padding:12px 8px 6px;font-size:12px;font-weight:600}._historyItem_1gms4_177{cursor:pointer;border-radius:6px;align-items:center;gap:10px;padding:10px 8px;font-size:14px;transition:background .15s;display:flex}._historyItem_1gms4_177:hover{background-color:#2a2a2a}._chatTitle_1gms4_207{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}._mainCanvas_1gms4_221{background-color:#212121;flex-direction:column;flex:1;height:100%;display:flex;position:relative}._topBar_1gms4_239{justify-content:space-between;align-items:center;height:56px;padding:0 16px;display:flex}._modelBadge_1gms4_255{color:#b4b4b4;font-size:15px;font-weight:600}._scrollContainer_1gms4_269{flex:1;padding-bottom:24px;overflow-y:auto}._contentConstrain_1gms4_281{max-width:720px;margin:0 auto;padding:0 16px}._messageRow_1gms4_293{flex-direction:column;gap:8px;padding:20px 0;animation:.3s ease-out forwards _fadeIn_1gms4_1;display:flex}@keyframes _fadeIn_1gms4_1{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}._identityGroup_1gms4_319{align-items:center;gap:12px;display:flex}._avatarIcon_1gms4_331{border-radius:50%;justify-content:center;align-items:center;width:28px;height:28px;font-size:12px;font-weight:700;display:flex}._userAvatar_1gms4_353{color:#fff;background-color:#543fd7}._assistantAvatar_1gms4_363{color:#fff;background-color:#10a37f}._senderLabel_1gms4_373{font-size:14px;font-weight:600}._bubblePayload_1gms4_383{color:#d1d1d1;padding-left:40px;font-size:16px;line-height:1.6}._bubblePayload_1gms4_383 p{margin:0}._typingIndicator_1gms4_407{align-items:center;gap:4px;height:24px;padding-left:40px;display:flex}._typingIndicator_1gms4_407 span{background-color:#b4b4b4;border-radius:50%;width:6px;height:6px;animation:1.4s ease-in-out infinite both _bounce_1gms4_1}._typingIndicator_1gms4_407 span:first-child{animation-delay:-.32s}._typingIndicator_1gms4_407 span:nth-child(2){animation-delay:-.16s}@keyframes _bounce_1gms4_1{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}._dockFooter_1gms4_457{background-color:#212121;padding:0 16px 24px}._dockConstrain_1gms4_467{flex-direction:column;gap:12px;max-width:720px;margin:0 auto;display:flex}._inputFormBox_1gms4_483{background-color:#2f2f2f;border:1px solid #424242;border-radius:16px;align-items:flex-end;padding:10px 14px;display:flex;position:relative}._spinnerCont_1gms4_503{text-align:center}._textField_1gms4_511{color:#fff;resize:none;background:0 0;border:none;outline:none;flex:1;max-height:200px;padding-right:40px;font-family:inherit;font-size:16px;line-height:1.5}._textField_1gms4_511::placeholder{color:#7d7d7d}._actionSendBtn_1gms4_547{color:#000;cursor:pointer;background-color:#fff;border:none;border-radius:8px;justify-content:center;align-items:center;width:32px;height:32px;font-size:12px;transition:background .2s,opacity .2s;display:flex;position:absolute;bottom:10px;right:10px}._actionSendBtn_1gms4_547:disabled{color:#171717;cursor:not-allowed;background-color:#424242}._disclaimerText_1gms4_595{color:#7d7d7d;text-align:center;margin:0;font-size:12px}.counter{color:var(--accent);background:var(--accent-bg);border:2px solid #0000;border-radius:5px;margin-bottom:24px;padding:5px 10px;font-size:16px;transition:border-color .3s}.counter:hover{border-color:var(--accent-border)}.counter:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.hero{position:relative}.hero .base,.hero .framework,.hero .vite{margin:0 auto;inset-inline:0}.hero .base{z-index:0;width:170px;position:relative}.hero .framework,.hero .vite{position:absolute}.hero .framework{z-index:1;height:28px;top:34px;transform:perspective(2000px)rotate(300deg)rotateX(44deg)rotateY(39deg)scale(1.4)}.hero .vite{z-index:0;width:auto;height:26px;top:107px;transform:perspective(2000px)rotate(300deg)rotateX(40deg)rotateY(39deg)scale(.8)}#center{flex-direction:column;flex-grow:1;place-content:center;place-items:center;gap:25px;display:flex}@media (width<=1024px){#center{gap:18px;padding:32px 20px 24px}}#next-steps{border-top:1px solid var(--border);text-align:left;display:flex}#next-steps>div{flex:1 1 0;padding:32px}@media (width<=1024px){#next-steps>div{padding:24px 20px}}#next-steps .icon{width:22px;height:22px;margin-bottom:16px}@media (width<=1024px){#next-steps{text-align:center;flex-direction:column}}#docs{border-right:1px solid var(--border)}@media (width<=1024px){#docs{border-right:none;border-bottom:1px solid var(--border)}}#next-steps ul{gap:8px;margin:32px 0 0;padding:0;list-style:none;display:flex}#next-steps ul .logo{height:18px}#next-steps ul a{color:var(--text-h);background:var(--social-bg);border-radius:6px;align-items:center;gap:8px;padding:6px 12px;font-size:16px;text-decoration:none;transition:box-shadow .3s;display:flex}#next-steps ul a:hover{box-shadow:var(--shadow)}#next-steps ul a .button-icon{width:18px;height:18px}@media (width<=1024px){#next-steps ul{flex-wrap:wrap;justify-content:center;margin-top:20px}#next-steps ul li{flex:calc(50% - 8px)}#next-steps ul a{box-sizing:border-box;justify-content:center;width:100%}}#spacer{border-top:1px solid var(--border);height:88px}@media (width<=1024px){#spacer{height:48px}}.ticks{width:100%;position:relative}.ticks:before,.ticks:after{content:"";border:5px solid #0000;position:absolute;top:-4.5px}.ticks:before{border-left-color:var(--border);left:0}.ticks:after{border-right-color:var(--border);right:0}
|
react-frontend/dist/favicon.svg
DELETED
react-frontend/dist/icons.svg
DELETED
react-frontend/dist/index.html
CHANGED
|
@@ -2,11 +2,11 @@
|
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8" />
|
| 5 |
-
<link rel="icon" type="image/svg+xml" href="/
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 7 |
<title>code-for-me</title>
|
| 8 |
-
<script type="module" crossorigin src="/assets/index-
|
| 9 |
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
| 10 |
</head>
|
| 11 |
<body>
|
| 12 |
<div id="root"></div>
|
|
|
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8" />
|
| 5 |
+
<link rel="icon" type="image/svg+xml" href="/app-icon.png" />
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 7 |
<title>code-for-me</title>
|
| 8 |
+
<script type="module" crossorigin src="/assets/index-CS_Vi0C2.js"></script>
|
| 9 |
+
<link rel="stylesheet" crossorigin href="/assets/index-D12vuxSS.css">
|
| 10 |
</head>
|
| 11 |
<body>
|
| 12 |
<div id="root"></div>
|
react-frontend/dist/vite.config.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
exports.__esModule = true;
|
| 3 |
+
var vite_1 = require("vite");
|
| 4 |
+
var plugin_react_1 = require("@vitejs/plugin-react");
|
| 5 |
+
// const BaseUrl = import.meta.env.VITE_API_LOCAL_HOST_BACKEND;
|
| 6 |
+
// https://vitejs.dev/config/
|
| 7 |
+
exports["default"] = vite_1.defineConfig({
|
| 8 |
+
// server: {
|
| 9 |
+
// // https: true as any,
|
| 10 |
+
// port: 5173,
|
| 11 |
+
// https: {
|
| 12 |
+
// key: fs.readFileSync('./ssl/certificate.key'),
|
| 13 |
+
// cert: fs.readFileSync('./ssl/certificate.crt'),
|
| 14 |
+
// },
|
| 15 |
+
// proxy: {
|
| 16 |
+
// '/api': {
|
| 17 |
+
// target: 'https://127.0.0.1:3000', // Point to your Express HTTPS server
|
| 18 |
+
// changeOrigin: true,
|
| 19 |
+
// secure: true, // Now secure because certs are trusted
|
| 20 |
+
// },
|
| 21 |
+
// },
|
| 22 |
+
// host: '127.0.0.1', // Exposes the app to your local network
|
| 23 |
+
// // proxy: {
|
| 24 |
+
// // '/api': {
|
| 25 |
+
// // target: 'https://localhost:3000', // Your backend server URL
|
| 26 |
+
// // changeOrigin: true,
|
| 27 |
+
// // secure: true, // Set to true if using HTTPS with a valid certificate
|
| 28 |
+
// // },
|
| 29 |
+
// // },
|
| 30 |
+
// },
|
| 31 |
+
// plugins:
|
| 32 |
+
// [
|
| 33 |
+
// nodePolyfills({
|
| 34 |
+
// include: ['crypto', 'util', 'stream', 'buffer'] // Add other Node modules if needed - 'stream', 'util', 'buffer'
|
| 35 |
+
// }),
|
| 36 |
+
// react(),
|
| 37 |
+
// FullReload([
|
| 38 |
+
// 'src/components/**/*.*',
|
| 39 |
+
// 'src/context/**/*.*',
|
| 40 |
+
// 'src/*.*',
|
| 41 |
+
// 'ReactiveFrontend/public/*.*'
|
| 42 |
+
// ]),
|
| 43 |
+
// mkcert()
|
| 44 |
+
// ],
|
| 45 |
+
plugins: [plugin_react_1["default"]()],
|
| 46 |
+
server: {
|
| 47 |
+
host: true,
|
| 48 |
+
port: 5173
|
| 49 |
+
}
|
| 50 |
+
});
|
requirements.txt
CHANGED
|
@@ -1,9 +1,11 @@
|
|
| 1 |
# --- AI & Model Inference (CPU optimized) ---
|
| 2 |
-
llama-cpp-python
|
| 3 |
huggingface_hub>=0.21.0
|
|
|
|
| 4 |
|
| 5 |
# --- Queue & Asynchronous Processing ---
|
| 6 |
redis>=5.0.1
|
|
|
|
| 7 |
|
| 8 |
# --- Utilities ---
|
| 9 |
pydantic>=2.6.0
|
|
|
|
| 1 |
# --- AI & Model Inference (CPU optimized) ---
|
| 2 |
+
llama-cpp-python==0.3.31
|
| 3 |
huggingface_hub>=0.21.0
|
| 4 |
+
python-dotenv
|
| 5 |
|
| 6 |
# --- Queue & Asynchronous Processing ---
|
| 7 |
redis>=5.0.1
|
| 8 |
+
bullmq
|
| 9 |
|
| 10 |
# --- Utilities ---
|
| 11 |
pydantic>=2.6.0
|