Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add dify assistant #173

Merged
merged 3 commits into from
Mar 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
@@ -44,7 +44,6 @@ module.exports = withBundleAnalyzer({
'imgse.com',
's3.us-west-1.amazonaws.com',
'file-cdn.openbuild.xyz',
'api.runllm.com',
],
},
webpack: config => {
67 changes: 67 additions & 0 deletions public/cat.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 64 additions & 0 deletions src/entry/components/DifyWidget/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* Copyright 2024 OpenBuild
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use client';

import Image from 'next/image';
import { useState } from 'react';

function DifyWidget() {
const [showFrame, setShowFrame] = useState(false);

const handleToggleFrame = () => {
setShowFrame(!showFrame);
};

return (
<>
{showFrame && (
<div className="fixed inset-0 bg-black/50 z-40 flex items-center justify-center">
<div className="w-full h-full max-w-4xl max-h-[80vh] bg-white dark:bg-gray-800 rounded-lg shadow-xl overflow-hidden relative">
<button
onClick={handleToggleFrame}
className="absolute right-3 top-3 z-10 h-6 w-6 cursor-pointer rounded border border-gray-400 fill-gray p-1"
>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth="1.5" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
<iframe
src="https://ai.openbuild.xyz/chatbot/IjylvCt33JZvfyRF"
className="w-full h-full min-h-[600px] border-none"
/>
</div>
</div>
)}
<button
onClick={handleToggleFrame}
className="fixed bottom-6 right-6 z-50 hover:opacity-80 transition-all transform hover:scale-110"
>
<Image
src="/cat.svg"
alt="Chat icon"
width={64}
height={64}
/>
</button>
</>
);
}

export default DifyWidget;
42 changes: 0 additions & 42 deletions src/entry/components/RunLlmWidget/index.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/entry/index.js
Original file line number Diff line number Diff line change
@@ -21,10 +21,10 @@ import { AppConfigContext } from '@/hooks/useAppConfig';
import { ReduxProviders } from '#/state/provider';

import setInterceptorsForHttpClients from './aspects/http';
import DifyWidget from './components/DifyWidget';
import { Providers } from './components/Providers';
import { RouteIntercept } from './components/RouteIntercept';
import { RouterProgress } from './components/RouterProgress';
import RunLlmWidget from './components/RunLlmWidget';
import { Toast } from './components/Toast';

setInterceptorsForHttpClients();
@@ -40,7 +40,7 @@ function ClientEntry({ config, children }) {
<RouteIntercept />
</ReduxProviders>
</RouterProgress>
<RunLlmWidget />
<DifyWidget />
</AppConfigContext.Provider>
</Providers>
);

Unchanged files with check annotations Beta

}}
>
{chain.iconUrl && (
<img

Check warning on line 136 in src/entry/components/Header/CustomConnectButton.js

GitHub Actions / lint

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
alt={chain.name ?? 'Chain icon'}
src={chain.iconUrl}
style={{ width: 18, height: 18 }}
return (
<button className="absolute top-3 right-3 md:top-4 md:right-[60px]">
<label htmlFor="upload-cover" className="flex items-center text-white gap-2 bg-[rgba(26,26,26,0.6)] hover:bg-[rgba(26,26,26,0.8)] rounded px-3 py-2 cursor-pointer">
<img className={clsx({'animate-spin': loading})} src={'/images/svg/refetch.svg'} alt="" />

Check warning on line 58 in src/domain/profile/widgets/banner/ImageUpload.js

GitHub Actions / lint

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
Change cover
</label>
<input
</div>
<div className="flex flex-wrap">
{nfts.map((i, k) => (
<img

Check warning on line 113 in src/app/shilling/[id]/page.js

GitHub Actions / lint

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
width={64}
height={64}
className="mr-4 mb-4 rounded-full"
<div className="absolute top-1/2 left-0 w-full border-b-2 border-dashed border-[#d1d9e0]" />
<div className="flex items-center justify-between py-9">
<div className="relative bg-white rounded-full size-[60px] md:size-[100px]">
<img src={clientInfo?.icon} alt="Logo" className="!size-full" />

Check warning on line 102 in src/app/oauth/page.js

GitHub Actions / lint

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
</div>
<div className="flex items-center gap-2 relative">
<SvgIcon name="circle-check" size={20} />
key={`contributor-slider-item-${k}-${t}`}
className={clsx('relative group w-full rounded-full hover:w-[calc(100%)]')}
>
<img src={j.picture.src} alt="" className={clsx('w-full aspect-square object-cover rounded-full relative z-[2] group-hover:z-10')} />

Check warning on line 142 in src/app/home/Contributor.js

GitHub Actions / lint

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
<div className={clsx('text-white box-border py-6 absolute top-[1px] left-[1px] w-[99%] h-[99%] transition-width !duration-300 overflow-hidden bg-gray rounded-full z-0',
'group-hover:w-[calc(200%+40px)] group-hover:pl-[100%] group-hover:ml-2 group-hover:z-[3]',